Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
read a file line by line in unix
Name: trichyselva Date: February 28, 2006 at 00:49:08 Pacific OS: windows xp CPU/Ram: p4 Product: pentium
Name: nails Date: February 28, 2006 at 09:03:09 Pacific
Reply:
#!/bin/ksh
while read line do echo $line done < mydatafile
0
Response Number 2
Name: gpatel Date: March 10, 2006 at 09:36:44 Pacific
Reply:
thanks nail. this kind of solved my problem too. Now, i have a question about this. I have this files that print garbage charactors. Its very hard to define those charactors and hard to find it too. and these charactors are different for different editors ( what i mean is if i open in nedit it will be like <soh> , if i open in text edit its like ^@).
what your script does it read line by line so its gonne stop at this perticular line and just gonne think and not do anything. is there anyway to get out and print an error message?
Thanks for all your help. gpatel Note: this charactors doesnt work with grep or there is no way to find it.
thanks, Gaurav
0
Response Number 3
Name: gpatel Date: March 10, 2006 at 11:04:59 Pacific
Summary: Hi, I wrote the following code to read a file line by line #!/bin/ksh for i in `cat a.txt` do echo $i done This is not showing me the file contents line bye line. Instead I am seeing a word by word ou...
Summary: - I need to read and ignore a file till i find a certain string and then write out the rest of the file in to another file using sh ... can some one help ? thanks i tried using cat and a for loop bu...