LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-15-2004, 07:51 PM   #1
tearinox
Member
 
Registered: Aug 2003
Location: you dont want to know
Distribution: Gentoo 2004.2, Slackware 10, Windows XP, Windows 2003 Server
Posts: 348

Rep: Reputation: 30
remove "special" text out of a file


Dont ask why, But I have a file that lists all my packages. What I need to do is delete the ending ( file.tgz ) Example:

file at first:

lilo.tgz
bob.tgz
eats.tgz
less.tgz

to change to:

lilo
bob
eats
less

Thanks
 
Old 03-15-2004, 08:43 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 261Reputation: 261Reputation: 261
You could do this using vi or vim with something like this in command mode:

:1,$ s/.tgz//g

Its basically going to remove any string that is .tgz globally in the file.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i remove this file "-gxxxx" zameer_india Linux - Newbie 6 01-29-2005 02:25 AM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 08:54 AM
need help, on how to access quickly to special characters like "" or ""? Motaro Linux - Newbie 1 12-31-2003 11:53 AM
Inputting a text file in to the "rm" command R4z0r Linux - General 5 12-28-2003 05:44 PM
How can I catch some "KEY WORDS" from a text file without opening it? yuzuohong Linux - General 1 06-14-2002 09:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:50 PM.

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