Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


Search this Thread
Old 04-30-2006, 09:51 PM   #1
Registered: Jul 2004
Posts: 171

Rep: Reputation: 30
sed question

Hi there. I need to append a string to the beginning of each line in a file. It doesn't have to be using sed, but so far I've had no luck with sed for this. The worst part of all of this is that i'm using so many grep, sed and cut statements that this thing is screaming at me to learn awk. Just don't have time for that at the moment.

Old 04-30-2006, 10:29 PM   #2
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Substitute "^" with whatever string you need:
sed -e 's/^/some string/'
Old 04-30-2006, 10:36 PM   #3
Registered: Jul 2004
Posts: 171

Original Poster
Rep: Reputation: 30
Thank you. I saw that in the sed one liner page, but i was putting an extra space after /^



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
Another SED question 3saul Linux - Software 2 01-28-2007 01:06 PM
[sed] "Advanced" sed question(s) G00fy Programming 2 03-20-2006 01:34 AM
sed question lazyuser Programming 4 02-11-2005 07:11 AM
sed question sphynx Programming 6 04-28-2004 07:25 PM
sed question zoomzoom Linux - Software 2 10-20-2003 05:04 PM

All times are GMT -5. The time now is 07:13 PM.

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