![]() |
|
|
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 |
| defining a variable using multiple "entries/columns" within a line using read | Torinator | Shell Programming and Scripting | 3 | 04-20-2009 03:52 PM |
| read -p "prompt text" foo say "read: bad option(s)" in Bourne-Shell | wiseguy | Shell Programming and Scripting | 9 | 01-28-2009 01:20 PM |
| script to read a line with spaces bet " " and write to a file | perlamohan | Shell Programming and Scripting | 3 | 11-12-2008 04:27 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| how to request a "read" or "delivered" receipt for mails | plelie2 | Shell Programming and Scripting | 1 | 08-06-2002 04:26 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I am using the time-honored construct "while read field1 field2 field3 ; do" to pull delimited fields from lines of data in a file, but there are a few places within the loop where I need to manipulate the entire, unsplit line of data. Does "while read" keep each entire record/line somewhere prior to its separating the fields -- perhaps in some special variable like $? or $0?
If not, I would either have to use "while read entireLine ; do" and then split up the fields inside the loop with cut or awk, or, use "while read var1 var2 etc. ; do" and paste the separate fields back together where a copy of the whole line is needed, neither of which is very elegant. Suggestions as to the prettiest, most elegant, or most standard way of having my cake and eating the slices too are most appreciated. --JMF |
| Bookmarks |
| Tags |
| fields, lines of data, read file, while read |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|