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, 03: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, 04:05 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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, 04: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 12:19 PM.
 
Old 10-13-2008, 04: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, 05:00 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
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, 05: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, 08:16 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,166

Rep: Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680Reputation: 2680
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, 08:44 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
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, 07: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 05:57 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 12:34 AM
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-03-2005 11:00 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:57 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
Open Source Consulting | Domain Registration