Sponsored Content
Top Forums Shell Programming and Scripting Create Multiple files by reading a input file and changing the contents Post 302353819 by bhargavkr on Wednesday 16th of September 2009 09:47:56 AM
Old 09-16-2009
Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me .
Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer.
I want to create a mutiple output files with each file having a seperate code which is stored in text file and create XYZ_222_999_YYYYMMDD_1.TXT . and add date in the contents next to series of numbers .Like this
Before change the file looks like this
file name XYZ_111_999_YYYYMMDD_1.TXT
001,19SEP2009-14:05:05,000000003
1234
4567
6785
END_OF_DATA
Output file should be as below
XYZ_222_111_YYYYMMDD_1.TXT where 222 will be from stored list or text file
001,222,19SEP2009-14:05:05,000000003
1234,19SEP2009-14:05:05,222
4567,19SEP2009-14:05:05,222
6785,19SEP2009-14:05:05,222
END_OF_DATA

List file will be as below
test.txt
222
333
444
555
666
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Reading input to create a variable in a script?

I would like to prompt for input and then use it as a variable in a script. Something like this. #!/bin/ksh echo "What is your name?: \c" read response echo "Your name is $reply" >file.txt done exit 0 What am I missing? Thanks, (7 Replies)
Discussion started by: darthur
7 Replies

2. Shell Programming and Scripting

Reading specific contents from 1 input files and appending it to another input file

Hi guys, I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help. I have 2 input files (example given below) Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies

3. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

Hi, I have a folder which contains multiple config.xml files and one input file, Please see the below format. Config Files format looks like :- Code: <application name="SAMPLE-ARCHIVE"> <NVPairs name="Global Variables"> <NameValuePair> ... (0 Replies)
Discussion started by: haiksuresh
0 Replies

4. Shell Programming and Scripting

How to create a CSV File by reading fields from separate files

SHELL SCRIPT Hi, I have 3 separate files within a folder. Every File contains data in a single column like File1 contains data mayank sushant dheeraj File2 contains DSA_AT MG_AT FLAT_09 File3 contains data 123123 232323 (2 Replies)
Discussion started by: mayanksargoch
2 Replies

5. Shell Programming and Scripting

While or For with looping contructs? to create files from contents of a text file

Hi so far I created this script: vi loop.beta.sh for i in `cat extract.filenames.tabc` do echo $i done>$i === This is the original text file. $ more tabc.txt -rwx------- 1 alice staff 1586 2010-11-05 02:27 request-key .conf -rwx------- 1 ted staff 126 ... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

6. Shell Programming and Scripting

Create different files from input file.

I have file A.txt File A 1,Hi,234 2,Hello,345 1,Kal,980, 9,KJ,098 2,de,098 .. ... I have more then 600 lines... I want separate the files as per 150 line. First 150 lines ----File A1.xtx Second 150 lines ---File A2.txt Third 150 lines----File A3.txt. ... (4 Replies)
Discussion started by: asavaliya
4 Replies

7. Shell Programming and Scripting

How to create multiple files from one file?

Hi everyone! I usually get large files with different groups of entries; for example, each line starts with A, B, C, D, or E. Is there a way to separate all these entries and then write them in 5 different files with one awk program? Thank you! (4 Replies)
Discussion started by: Avro1986
4 Replies

8. Shell Programming and Scripting

Search & Replace in Multiple Files by reading a input file

I have a environment property file which contains: Input file: value1 = url1 value2 = url2 value3 = url3 and so on. I need to search all *.xml files under directory for value1 and replace it with url1. Same thing I have to do for all values mentioned in input file. I need script in unix bash... (7 Replies)
Discussion started by: Shamkamde
7 Replies

9. Shell Programming and Scripting

Reading contents of files from a directory

I have a directory with the files, 1st: I want to Diplay each filename, underline it 2nd: Display the contents under the filename and 3rd: Redirect the above content to other file 4th: Remove the files from the directory #!/bin/ksh for i in $( cat $a/b/c.txt ) do echo "... (1 Reply)
Discussion started by: Aditya_001
1 Replies

10. UNIX for Beginners Questions & Answers

Output file name and file contents of multiple files to a single file

I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this. --- Post updated at... (5 Replies)
Discussion started by: Kentlee65
5 Replies
PSREPORT(1)							   User Commands						       PSREPORT(1)

NAME
psreport: - report on the packets in a Program Stream SYNOPSIS
psreport [switches] <infile> DESCRIPTION
TS tools version 1.11, psreport built Nov 11 2008 17:15:47 Report on the packets in a Program Stream. Files: <infile> is an H.222 Program Stream file (but see -stdin) Switches: -stdin Input from standard input, instead of a file -verbose, -v Output packet data as well. -max <n>, -m <n> Maximum number of PS packets to read -dvd The PS data is from a DVD. This is the default. This switch has no effect on MPEG-1 PS data. -notdvd, -nodvd The PS data is not from a DVD. The DVD specification stores AC-3 (Dolby), DTS and other audio in a specialised manner in pri- vate_stream_1. TS tools version 1.11, psreport built Nov 11 2008 17:15:47 Report on the packets in a Program Stream. Files: <infile> is an H.222 Program Stream file (but see -stdin) Switches: -stdin Input from standard input, instead of a file -verbose, -v Output packet data as well. -max <n>, -m <n> Maximum number of PS packets to read -dvd The PS data is from a DVD. This is the default. This switch has no effect on MPEG-1 PS data. -notdvd, -nodvd The PS data is not from a DVD. The DVD specification stores AC-3 (Dolby), DTS and other audio in a specialised manner in pri- vate_stream_1. SEE ALSO
The full documentation for psreport is maintained as a Texinfo manual. Please check http://tstools.berlios.de for more information. psreport 1.11 November 2008 PSREPORT(1)
All times are GMT -4. The time now is 07:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy