![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read command | COD | Shell Programming and Scripting | 4 | 04-26-2008 01:49 PM |
| help with READ command | fiol73 | UNIX for Dummies Questions & Answers | 2 | 12-15-2006 11:13 AM |
| REad Command | bourne | Shell Programming and Scripting | 2 | 06-19-2006 07:02 AM |
| AWK : read unix command | fwirbel | Shell Programming and Scripting | 6 | 02-08-2005 05:11 AM |
| Cat and read command | mango | Shell Programming and Scripting | 3 | 12-29-2003 10:55 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
can any one please help me how to use "read" command for openig a file.i want to process the file record by record and then needs to search for a particular string at a particular position.can any one please let me know the code.i am new to the shell.
below are sample sample records D6303200805066HJ8164-61002EURO6303I0073554514 D6303200805066HJ8164-61002EURO6303I0073554514 your help would appreciate..... thanks rao. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
read simply reads standard input. You probably want to use redirection.
Code:
while read line; do echo "Read line '$line'" done <file |
|
#3
|
|||
|
|||
|
thanks ray.
i have seen the below code.but i am not getting wht the "line" signifies in the read command?i am very new to unix scripting.could you please write elabrately somethign in the code. coming to search pattern i have to search at 14and15 postion of the record whether it equals to '6h' or not.if so i have to write that coressponding record into a separate file. i really appreciate your help. advancedthanks narasimharao. |
|
#4
|
|||
|
|||
|
If that's all you need, read is not really appropriate.
Code:
egrep '^.{13,14}6h' file >separatefile
read variablename reads a line of input, which is subsequently available in $variablename -- you can of course call your variables anything you like. ("ray", huh? Had't come across that particular one before ...) Last edited by era; 05-19-2008 at 05:21 AM. Reason: egrep -i to ignore case |
|||
| Google The UNIX and Linux Forums |