Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with file manipulation script Post 302647089 by jeyd on Sunday 27th of May 2012 08:59:09 AM
Old 05-27-2012
JayAbram thanks much but it is not quite what i am looking for. With you solution I will need to change the filenames manually 20 times. Sometimes my program will generate more than 20 files and I will have to do the same as many time. I want something like a little for loop which will loop through the list of files and append the content of each trailers to its respective detail file.

Detail File: "MyDetailFile.TXT_01-02-2002"
01-02-2002aaaaa23334 JanetBrown female active y D
01-02-2002aaaaa23334 MaryBondfemale active n D
01-02-2002aaaaa23334 JimanJones male active y D
01-02-2002aaaaa23334 LinusWrightmale active n D

Trailer file :"MyTrailerFile.DAT_01-02-2002"
01-01-200201-31-20021 T

Final output for each detail file in the directory should be like this:
MyDetailFile.TXT_01-02-2002
01-02-2002aaaaa23334 janejones female active y D
01-02-2002aaaaa23334 MaryBondfemale active n D
01-02-2002aaaaa23334 janejones male active y D
01-02-2002aaaaa23334 MaryBondfemale active n D
01-02-200201-31-20024 T

Note: the first 10 characters in the detail file name always matches with the last 10 charaters of the matching trailer , this is away to identify each detail and trailer pair for the merging.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

data manipulation script

I have a folder called {homedata} Within this folder there are 12 subfolders 200601.......200612 Within each subfolder there are 8 sets of files Each filename commences with A B C D E F G or H, so {filename}* can be used. I am trying to write a script which will from the top level go... (1 Reply)
Discussion started by: grinder182533
1 Replies

2. Shell Programming and Scripting

perl script file manipulation

Please let me know.. How to manipulate the data from two files..? I have two files, file1 has two columns one is variable and second is description. file2 has five columns first column is variable and last one is description..Appreciate the help I need to overwrite the description from file1... (5 Replies)
Discussion started by: ddk2oo5
5 Replies

3. Shell Programming and Scripting

Shell script text file manipulation.

Hello, I have mysql binary file which logs all the database queries and i to insert all queries log in to database. First i coverted binary file to text file. and start playing with it. Text file contains following queries, some samples are, SET INSERT_ID=1; INSERT INTO test... (0 Replies)
Discussion started by: mirfan
0 Replies

4. Shell Programming and Scripting

Difficult problem: Complex text file manipulation in bash script.

I don't know if this is a big issue or not, but I'm having difficulties. I apoligize for the upcoming essay :o. I'm writing a script, similar to a paint program that edits images, but in the form of ANSI block characters. The program so far is working. I managed to save the image into a file,... (14 Replies)
Discussion started by: tinman47
14 Replies

5. UNIX for Dummies Questions & Answers

Filtering records from 1 file based on some manipulation doen on second file

Hi, I am looking for an awk script which should help me to meet the following requirement: File1 has records in following format INF: FAILEd RECORD AB1234 INF: FAILEd RECORD PQ1145 INF: FAILEd RECORD AB3215 INF: FAILEd RECORD AB6114 ............................ (2 Replies)
Discussion started by: mintu41
2 Replies

6. UNIX for Dummies Questions & Answers

Script for data manipulation

Hi all! my first post here, so mods -- if this should ideally be in the scripts section, please move there. Thanks! I have data in the following format: key1:value1 key2:value2 key3:value3 A B C D key1:value4 key2:value5 key3:value6 A1 B1 key1: ... and so on I want an output... (2 Replies)
Discussion started by: gnat01
2 Replies

7. Shell Programming and Scripting

Awk to convert a text file to CSV file with some string manipulation

Hi , I have a simple text file with contents as below: 12345678900 971,76 4234560890 22345678900 5971,72 5234560990 32345678900 71,12 6234560190 the new csv-file should be like: Column1;Column2;Column3;Column4;Column5 123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies

8. Shell Programming and Scripting

Help with data manipulation script

Y,T,,H05,6,6,0,0 -> TH05_6 D,5,BT,B -> BT_KIOSK P,KQC222 -> KQC222 G,B,2 -> BRANI_GATE_2 fileA TPM658 Y,T,,H05,6,6,0,0 TPM110 D,5,BT,B TPM136 P,KQC222 TPM180 P,BQC913 TPM575 Y,B,,T05,14,14,0,0 IPM760 G,B,2 TPM011 I need to use second column $1,$2,$3,$4..... if first char... (6 Replies)
Discussion started by: ment0smintz
6 Replies

9. Shell Programming and Scripting

Populating File data with custom manipulation on file names

Hi, I am confused how to proceed firther please find the problem below: Input Files: DCIA_GEOG_DATA_OCEAN.TXT DCIA_GEOG_DATA_MCRO.TXT DCIA_GEOG_DATA_CVAS.TXT DCIA_GEOG_DATA_MCR.TXT Output File Name: MMA_RFC_GEOG_NAM_DIM_LOD.txt Sample Record(DCIA_GEOG_DATA_OCEAN.TXT):(Layout same for... (4 Replies)
Discussion started by: Arun Mishra
4 Replies

10. Shell Programming and Scripting

File Manipulation - UNIX script

Hi, I have a file about 100 lines. Each line is about 2000 characters (each line is fixed length). In middle of each line is following constant value 0000040029892586 Now, I want to go through each line and increment by 1. So, line 1 will have 586 line 2 will have 587, line 3 will have... (4 Replies)
Discussion started by: jakSun8
4 Replies
GETLIST(1)						      General Commands Manual							GETLIST(1)

NAME
getlist - get a list from an NNTP server SYNOPSIS
getlist [ -h host ] [ list [ pattern [ types ] ] ] DESCRIPTION
The getlist program obtains a list from an NNTP server and sends it to standard output. The list may be one of active, active.times, distributions, or newsgroups. These values request the active(5), active.times, <pathetc in inn.conf>/distributions. or <pathdb in inn.conf>/newsgroups files, respectively. OPTIONS
-h If the ``-h'' flag is used, then the program connects to the server on the specified host. The default is to connect to the server specified in the inn.conf(5) file. If the list parameter is active, then the pattern and types parameters may be used to limit the output. When pattern is used, only active lines with groups that match according to wildmat(3) are printed. When types is also given, only active lines that have a fourth field starting with a character found in types are printed. For example, the following command will obtain the one-line descriptions of all newsgroups found on UUNET: getlist -h news.uu.net newsgroups The following line lists all groups where local postings are permitted, are moderated or aliased: getlist active '*' ym= Note that the listing files other than the active file is a common extension to the NNTP protocol and may not be available on all servers. HISTORY
Written by Landon Curt Noll <chongo@toad.com> for InterNetNews. SEE ALSO
active(5), inn.conf(5), nnrpd(8), wildmat(3). GETLIST(1)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy