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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to delete chars from a txt file 1

Status
Not open for further replies.

banatello

Technical User
May 18, 2009
4
US
I have a file with the name of movies with the .vob extension. I would like to get rid of the .vob off the name. I tried using sed '/.vob/d' vob.lst, but nothing happened. Can somebody tell me what I'm doing wrong ?
 
Good morning. See Thread822-1308581 for a couple of suggestions.

Some days are diamonds, some days are rocks - make sure most are the former.
 
Hi

banatello said:
I tried using sed '/.vob/d' vob.lst, but nothing happened.
What you wrote means "read the file vob.lst and delete those lines which contain any character followed by the string 'vob'". I suppose every line of vob.lst contained any character followed by the string 'vob', so all was deleted and none printed out. So actually happened something, just not what you expected.

If you find hard to understand how those described in the [tt]sed[/tt] manual works, I suggest to google for "sed one-liner" for some very simple examples. There you will see how to use practically what the manual described.

Feherke.
 
Thanks for the help guys. The redirect worked perfect.
 
1. If the file has names with .vob extensions only, try this:
sed 's/.vob$//g'

2. If the file has other names along with .vob extension files, try this:
sed -n '/.vob$/p' string | sed 's/.vob$//g'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top