Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Search this Thread
Old 01-26-2004, 02:42 AM   #1
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
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


for example I want to find the value, change it to 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?

Old 07-18-2005, 08:15 PM   #2
LQ Newbie
Registered: Apr 2005
Posts: 27

Rep: Reputation: 15

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Text-File through bash script arkus Programming 2 12-17-2004 09:48 PM
Search and replace text in file using shell script? matthurne Linux - Software 2 11-02-2004 11:11 AM
Shell script - how to show a specific line of a text file davi_cabral Linux - Software 3 09-28-2004 02:39 PM
How to delete a line from a text file with shell script programming Bassam General 1 01-28-2004 09:51 PM
how to convert a text file into shell script meng_en Linux - General 9 10-15-2002 11:46 PM

All times are GMT -5. The time now is 11:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration