LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 06: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, 07:06 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

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

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

All times are GMT -5. The time now is 03:43 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