![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Parsing a line in Shell Script | unishiva | Shell Programming and Scripting | 3 | 11-01-2007 04:30 PM |
| Parsing line out of a file, please help !! | xeniya | Shell Programming and Scripting | 5 | 05-31-2007 12:52 PM |
| problem parsing output file | ragha81 | Shell Programming and Scripting | 13 | 03-21-2007 02:06 PM |
| Problem with parsing a large file | gauravgoel | Shell Programming and Scripting | 6 | 10-18-2006 06:48 PM |
| parsing a delimited line | monkeys | Shell Programming and Scripting | 11 | 07-12-2006 07:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem parsing line in file
I am VERY new to unix scripting. I am having trouble parsing a line into fields for further processing.
I have this script: #bin/sh cat ztest2.txt | while read line do zvar1=`echo $line | cut -f6` echo "zvar1 is " $zvar1 done ******************** ztest2.txt looks like: 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 10 4 5 6 7 8 9 10 11 where the spaces in between the numbers are tabs. the output of this script is: zvar1 is 1 2 3 4 5 6 7 8 zvar1 is 2 3 4 5 6 7 8 9 zvar1 is 3 4 5 6 7 8 9 10 zvar1 is 4 5 6 7 8 9 10 11 if i just run from the command line: cut -f6 ztest2.txt i get 6 7 8 9 Can anyone help. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|