LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-26-2008, 09:46 AM   #1
kaplan71
Member
 
Registered: Nov 2003
Posts: 716

Rep: Reputation: 39
Modifying on a large scale a text file to include additional information


Hi there --

I need to modify a text file so that it contains additional information per line.

An example of what I want to accomplish is shown below. The file in question is another file that is set up the way that I want it:

Quote:
drwxrwxrwx+ 2 Administ SYSTEM 4096 Oct 9 20:24 00000000
drwxrwxrwx+ 2 Administ SYSTEM 53248 Sep 4 18:18 0011183
drwxrwxrwx+ 2 Administ SYSTEM 49152 Sep 4 19:16 0069847
drwxrwxrwx+ 2 Administ SYSTEM 77824 Sep 4 16:54 012903
An excerpt of the file that I want to modify in order that it may look like the one above is shown below:

Quote:
00000000
0011183
0069847
012903
I was able to do a copy and paste of the first several fields from the first file to the second with the results being as follows:

Quote:
drwxrwxrwx+ 2 Administ SYSTEM 00000000
drwxrwxrwx+ 2 Administ SYSTEM 0011183
drwxrwxrwx+ 2 Administ SYSTEM 0069847
drwxrwxrwx+ 2 Administ SYSTEM 012903
While this works, the total amount of lines in the second file, and also future files of this type is over five hundred (500). Is there a way to do the copy and paste that I described on a large scale to the second file? Thanks.
 
Old 06-26-2008, 10:16 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,458

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
Look at the join command. It merges lines of files based on a common field. With the -o option you can select which fields from each file join together. See man join for details.
 
  


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
extracting a chunk of text from a large text file lothario Linux - Software 3 02-28-2007 08:16 AM
Pulling only additional information from a text file Centinul Programming 40 09-19-2006 07:17 PM
Reading Large Text File in C++ maheshrajn Programming 6 03-04-2006 08:54 AM
Large text file synapse Slackware 3 02-28-2006 01:21 AM
SSI include line from text-file? @ngelot Programming 4 05-11-2005 06:43 AM


All times are GMT -5. The time now is 10:08 AM.

Main Menu
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