LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 06-22-2004, 07:36 AM   #1
blubbfish
LQ Newbie
 
Registered: Feb 2004
Posts: 29

Rep: Reputation: 15
Question Help improving a textfile


Hi,
i search for a command to append some text at the end of each line of a textfile.
So here is a part of the text file:
Textfile:
--------------------
blaaaaaa blfjdjeie
wsfewsef
fwefrwerfw4er
fwefrwe
--------------------
now i want the file to bi filled up like this:
--------------------
blaaaaaa blfjdjeie"EXTRATEXT"
wsfewsef"EXTRATEXT"
fwefrwerfw4er"EXTRATEXT"
fwefrwe"EXTRATEXT"
--------------------
so filling up the textfile i get with completing just the end of each line with the same expression.

Please help me you great Maters of the magic shell ;-)
 
Old 06-22-2004, 08:06 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Using sed:

sed 's/\(.*\)/\1 "Some text"/' Textfile

Using awk:

awk '{ print $0, "Some text" }' Textfile

Just 2 examples, there are more ways to do this.
 
Old 06-22-2004, 09:02 AM   #3
blubbfish
LQ Newbie
 
Registered: Feb 2004
Posts: 29

Original Poster
Rep: Reputation: 15
Thanks a lot for your help ... works fine
 
  


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
Encoding of a textfile Anden008 Linux - Newbie 3 11-15-2005 03:07 PM
textfile editing blubbfish Linux - General 9 10-20-2004 03:00 AM
How to exit the less textfile command? dubbuk Linux - Newbie 4 05-03-2004 05:47 PM
[c] adding header to textfile jb_li Programming 6 02-29-2004 02:17 AM
PDF to TextFile? Gerardoj Linux - Software 3 09-29-2003 06:00 PM


All times are GMT -5. The time now is 12:04 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration