2012-12-27 15 views
6

में स्ट्रिंग के पहले कॉलम (चर लंबाई) को कैसे कट करें शैल में स्ट्रिंग के पहले कॉलम (चर लंबाई) को कैसे कट करें? स्ट्रिंग केखोल

पूर्व:

23006 help.txt

मैं आउटपुट के रूप में 23,006 की जरूरत

उत्तर

15

कई तरीके:

cut -d' ' -f1 <filename # If field separator is space 
cut -f1 <filename # If field separator is tab 
cut -d' ' -f1 <filename | cut -f1 # If field separator is space OR tab 
awk '{print $1}' filename 
while read x _ ; do echo $x ; done < filename 
1
cut -d " " -f1 test.txt 

जहां test.txt अपने इनपुट पंक्ति है