LinuxQuestions.org
Help answer threads with 0 replies.
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 03-04-2014, 11:38 AM   #1
Migasi
LQ Newbie
 
Registered: Mar 2014
Posts: 1

Rep: Reputation: Disabled
Add a FileID and delete one line for 900 txt files


Here is what I have to do and I wonder if there is an AWK or SED script to help me.

Here is the series of events.
1. There are 900 txt files, each with a Filename on line 23 and a null line of characters on line 27
2. Each of the 900 txt file needs a FileID
3. Each of the 900 txt file does not contain a FileID and this FileID has to be extracted from a separate document.
4. There is a separate spreadsheet document containing the Filenames in column 1 and corresponding FileIDs in column 2
5. The fileID could be added to the 900 txt files before line 27 is deleted.
6. The aim in the script is to do the following:

A. Read the Filename on line 23 column 30 of the first .txt file.
B. Go to the separate spreadsheet to identify that Filename then extract its corresponding FileID.
C. Print the extracted FileID onto line 38 column 30 of the first .txt file.
D. Deleted line 27 of that first .txt file
E. Go to the next .txt file and so on....


How do I do that?

Thanks

Regards,

Migasi
 
Old 03-04-2014, 02:16 PM   #2
Clovis_Sangrail
LQ Newbie
 
Registered: Mar 2012
Posts: 13

Rep: Reputation: Disabled
Question

Quote:
Originally Posted by Migasi View Post
1. There are 900 txt files, each with a Filename on line 23 and a null line of characters on line 27
Do you mean line 27 is a blank line?
 
Old 03-04-2014, 04:52 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,832

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Quote:
Originally Posted by Migasi View Post
Here is what I have to do and I wonder if there is an AWK or SED script to help me.
Extraordinarily unlikely.
You'll have to write it yourself - awk would be the better option.

Take a small subset of the data and start coding - that way you can catch most of hte bugs before you get full-scale. When you have specific problems with the script we may be able to help.
 
  


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
[SOLVED] awk question - read in txt files, offset data by given amount, output new txt files pomico Programming 19 09-17-2012 12:43 PM
Extracting second line from multiple txt files and append to a file sal_x_sal Linux - Newbie 11 08-12-2012 05:00 PM
[SOLVED] Delete regular files (not hidden files) with find + rm in one line older than 15 Virtuose Linux - Newbie 1 01-08-2011 06:24 PM
How to delete a line with certain format from files in a directory admod Linux - General 1 09-22-2010 01:07 AM
Copy the contents of a txt file to other txt files (with similar names) by cp command TheIndependentAquarius Linux - Newbie 7 07-03-2010 01:54 AM


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