LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to find and change a specific text in a text file by using shell script (http://www.linuxquestions.org/questions/programming-9/how-to-find-and-change-a-specific-text-in-a-text-file-by-using-shell-script-138695/)

Bassam 01-26-2004 02:42 AM

How to find and change a specific text in a text file by using shell script
 
Hi All,
I am using shell script programming and I have text file consistes of 2 fields separated with TAB space, I want to search for a specific value in the second feild then change that value and then read the value of the first field of the same record.

the text file is

0 198.12.45.30
1 250.12.180.129
2 110.115.20.128
3 200.200.2.200

for example I want to find the value 110.115.20.128, change it to 0.0.0.0 and read the value of the first field for the same record which is 2.

so could u tell me how can I do this operation by using shell script programming?

Regards
Bassam

igimaster 07-18-2005 08:15 PM

well
 
I'd recommend
awk
sed
grep
for loops
What I recommend is you go to www.tldp.org and read their advanced bash scripting guide. It will have all the info you are looking for when combined with man pages.
danny


All times are GMT -5. The time now is 06:49 AM.