Try saving the following script in a file (I used the name runner while testing it, but choose anything you like). Make it executable using chmod +x file_name and run it using ./runner header.txt main.txt to test it with the sample files you provided. The output this awk script produces match the output you requested (as long as you remove the trailing empty line at the end of main.txt) except that there are no spaces before tabs in the header line:
You can invoke this script with any even number of files >=2 where the 1st file in each pair is in the format of header.txt and the 2nd file in each pair is in the format of main.txt.
This User Gave Thanks to Don Cragun For This Post:
hi all,
In an mp3 file , data is arranged in sequence of header and data ,how to retrieve data between two headers. Is the data between two headers fixed? because as per theory it says 1152 samples will be there , but dont knw how many bits one sample correspond to?
it would help if any c... (2 Replies)
I have a file with data extracted, and need to insert a header with a constant string, say: H|PayerDataExtract
if i use sed, i have to redirect the output to a seperate file like
sed ' sed commands' ExtractDataFile.dat > ExtractDataFileWithHeader.dat
the same is true for awk
and... (10 Replies)
Hi All,
I am having an XML tag like:
<detail sim_ser_no_1="898407109001000090"
imsi_1="452070001000090">
<security>ADM1=????</security>
<security>PIN1=????</security>
<security>PIN2=????</security>
... (2 Replies)
hi people;
this is my file1.txt:192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
...
this is my file2.txt:portnames
usernames
maxusercap
...
i want to write to file3.txt:l ./getports 192.168.1.1 'get all;l+;get . portnames;l-'
l ./getports 192.168.1.1 'get all;l+;get . usernames;l-'... (4 Replies)
Hi friend i have input as following XML file
<?xml version="1.0"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.02">
<BkToCstmrDbtCdtNtfctn>
<GrpHdr><MsgId>LBP-RDJ-TE000000-130042430010001001</MsgId><CreDtTm>2013-01-04T03:21:30</CreDtTm></GrpHdr>... (3 Replies)
Hi,
How can I combine the data of of three files into one new file?
I try to give as much informations as possible.
The three existing files are called file1 file2 and file3
the new file should named output_combined.
The size of the files will be around 900 words/lines each .. but always... (5 Replies)
The below bash is a file validation check executed that will verify the correct header count of 10 and the correct data type in each field of the tab-delimited file. The key has the data type of each field in it. My real data has 58 headers in it but only the header and next row need to be... (6 Replies)
Discussion started by: cmccabe
6 Replies
LEARN ABOUT OPENDARWIN
cr
cr(1) General Commands Manual cr(1)NAME
cr - converts text files between nix EOL and dos EOL
SYNOPSIS
cr - | + <input file> <output file>
DESCRIPTION
Text files, such as tle files, that come from a dos source usualy have the ^M symbol at the end of every line. Cr converts files between
the dos newline format and the normal *nix newline format by stripping the ^M to convert dos to *nix, using the '-' option, or adding ^M to
a *nix file to create the proper dos file when the '+' option is used.
Although this extra character is not often a problem, programs like seesat5, which are data driven will encounter parsing problems when the
extra character is present. It is these problems that cr is intended to repair.
Options
- | + One or the other of these options is required. The '-' option is used to remove ^M from all newlines found in the dos file. The '+'
option is used to add ^M to every newline found in a *nix file.
input file
Fully delineated path to the input file. As this program is used in the dos environment as well, standard input is not used.
output file
Fully delineated path to the output file. As this program is used in the dos environment as well, standart output is not used.
SEE ALSO seesat5(1), seesat5(7), SEESAT5.INI(5), tle(5)BUGS
Cr is not an inteligent program. It methodicaly replaces/removes the offending character when it finds it in the correct context. Newline
sequences found in contexts other than 'newline' will be replaced/removed just like those found in the proper context. Passing a binary
file through cr is not advised, for this reason. Send all inqueries to Dale Scheetz <dwarf@polaris.net>.
Debian Linux 2 April 96 cr(1)