Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace delimiters 1

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
Hello, I have a file that is tab delimited. I was wondering how can I change the tab to |.

Dodge20
 
To do it with vi type this:
:%s/ /|/g


The character you can't see between the first / and the second / is a tab.

To do it with sed:

sed 's/ /|/g' test.txt > test2.txt

 
How do I get rid of the END that is at the end of each line?

Dodge20
 
nevermind that was actually in the file. My real question is how do I get rid of quotation marks that surround a name?

Dodge20
 
What do you see at the end of each line?
 
If you want to get rid of all quotation marks and replace the marks with nothing, use this with vi:

:%s/"//g

and with sed:

sed 's/"/|/g' test.txt > test2.txt

What these things are doing is:

search (the s)/what-you-are-searching-for/what-you-are-replacing/global (the g)

the :% for vi is getting you to the command mode (or whatever it's called) to execute it.

Thanks for the star.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top