LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-13-2008, 04:56 PM   #1
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 117

Rep: Reputation: Disabled
Do you use SED often ?


If you do, what specific uses do you have for it?
 
Old 10-13-2008, 05:05 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,580
Blog Entries: 14

Rep: Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969Reputation: 969
I use sed any time I need to do pattern substitution (including deletions by substituting something with nothing). It is great at that.
 
Old 10-13-2008, 05:33 PM   #3
jb_get
Member
 
Registered: Sep 2008
Location: America
Distribution: Debian
Posts: 33

Rep: Reputation: 16
I use it pretty often, most of the time its for pattern substitution. Sometimes i use it to delete lines that are either blank or only contain spaces.

Last edited by Tinkster; 09-16-2010 at 01:19 PM.
 
Old 10-13-2008, 05:53 PM   #4
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
every day and in almost all my scripts. I'd be totaly lost without it.
 
Old 10-13-2008, 06:00 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 122Reputation: 122
I don't do much fancy with it, but I do do substitutions regularly. Nameservers changed? Just:
Code:
sed -i 's/oldserver/newserver/' /etc/resolv.conf
Just simple stuff like that.
 
Old 10-13-2008, 06:58 PM   #6
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 117

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jlightner View Post
I use sed any time I need to do pattern substitution (including deletions by substituting something with nothing). It is great at that.
What kind of files are you working with?
 
Old 10-13-2008, 09:16 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
It works on any text (ie non-binary) format file.
Personally, as per Matir I only use it for quick/simple stuff. Anything fiddly & I jump into Perl. Its my main lang these days anyway...
 
Old 10-13-2008, 09:44 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
I installed Cygwin/X at work so I can take a directory listing of a DVD backup (of mpeg commercials) and use sed to extract just the dates & filenames, creating a .csv file. Then I'll use merge the files, sort them and use enscript to produce a postscript catalog of all of the backups. The ps2pdf program converts the postscript file to a pdf file that I save on the server. Then if someone needs a spot retrieved from backup, they just need to use "find" in acroread to find out when it was created, and on which DVD it is backed up to.

---
Using comm or "grep -f" and then sed I'll create a script to delete certain files in devices, we use. To do it graphically would take days instead of minutes.
 
Old 10-14-2008, 08:51 PM   #9
CoffeeKing!!!
Member
 
Registered: Mar 2008
Posts: 117

Original Poster
Rep: Reputation: Disabled
Thanks everyone
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
using sed Fond_of_Opensource Linux - Newbie 2 11-20-2006 06:57 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 12:36 PM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 01:34 AM
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-04-2005 12:00 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM


All times are GMT -5. The time now is 02:15 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration