Find header in a text file and prepend it to all lines until another header is found
I've been struggling with this one for quite a while and cannot seem to find a solution for this find/replace scenario. Perhaps I'm getting rusty.
I have a file that contains a number of metrics (exactly 3 fields per line) from a few appliances that are collected in parallel. To identify the appliance the metrics belong to, there's a header (the name of the asset basically) that is printed just once before all the rest of the text.
What I want to do is find the appliance name and print it before each one of the metrics. See below:
Sample input:
Expected output:
The ending file should, therefore, contain lines with 4 fields each one. Any clues or pointers would be appreciated.
I am trying to get a total number of tapes w/out headers or footers in a ERV file and append it to the file. For some reason I cannot get it to work. Any ideas?
#!/bin/sh
dat=`date +"%b%d_%Y"`
+ date +%b%d_%Y
dat=Nov16_2006
tapemgr="/export/home/legato/tapemgr/rpts"... (1 Reply)
Hi Gurus,
I have a requirement like this and have to create a UX shell scripts. Thanks in advance.
File-in:
------
Header2007-12-012007-11-21
100|xyz|was
101|wsa|qws
......
.......
Output should be:
-------------------
2007-12-01|100|xyz|was
2007-12-01|101|wsa|qws
......
.......... (7 Replies)
say i have these many file in a directory named exam.
1)/exam/newfolder/link.txt.
2)/exam/newfolder1/
and i create a tar say exam.tar
well the problem is,
when i read the tar file i dont find any metadata about the directories,as you cannot create a tar containig empty directories.
on the... (2 Replies)
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)
So, I have a file that has some duplicate lines. The file has a header line that I would like to keep at the top.
I could do this by extracting the header from the file, 'sort -u' the remaining lines, and recombine them. But they are quite big, so if there is a way to do it with a single... (1 Reply)
Hi All,
I need to BCP out a table into a text file along with the table headers. Normal BCP out command only bulk copies the data, and not the headers.
I am using the following command: bcp database1..table1 out file1.dat -c -t\| -b1000 -A8192 -Uuser -Ppassword -efile.dat.err
Regards,... (0 Replies)
Hello All,
I have a file in the following format. I want to extract the date(020090930, 020090929) in the string "STPAGE020090930" and "STPAGE020090929" and prefix it to all lines below them. The output must be put into a new file.
STPAGE020090930
xyzz aalc... (3 Replies)
Friends,
I need help with the following in UNIX.
Merge all csv files in one folder considering only 1 header row and ignoring header of all other files.
FYI - All files are in same format and contains same headers.
Thank you (4 Replies)
I would like to print the output beginning with a header from a seperate file like this:
awk 'BEGIN{FS="_";print ((getline < "header.txt")>0)} { if (! ($0 ~ /EL/ ) print }" input.txtWhat am i doing wrong? (4 Replies)
Hi
I have in put file A.txt
ABCDE1 JFHFJFJF3 1 1 SC1 12/10
ABCDE2 JFHFJFJF5 1 1 SC1 12/10
ABCDE3 JFHFJFJF5 1 1 SC1 12/10
ABCDE4 JFHFJFJF6 1 1 SC1 12/10
I want output in .csv with header:
Name SUb_N x y No Board
ABCDE1 JFHFJFJF3 1 1 SC1 12/10
ABCDE2 JFHFJFJF5 1 1 SC1... (7 Replies)
Discussion started by: pareshkp
7 Replies
LEARN ABOUT OSX
random
RANDOM(4) BSD Kernel Interfaces Manual RANDOM(4)NAME
random , urandom -- random data source devices.
SYNOPSIS
pseudo-device random
DESCRIPTION
The random device produces uniformly distributed random byte values of potentially high quality.
To obtain random bytes, open /dev/random for reading and read from it.
To add entropy to the random generation system, open /dev/random for writing and write data that you believe to be somehow random.
/dev/urandom is a compatibility nod to Linux. On Linux, /dev/urandom will produce lower quality output if the entropy pool drains, while
/dev/random will prefer to block and wait for additional entropy to be collected. With Yarrow, this choice and distinction is not necessary,
and the two devices behave identically. You may use either.
OPERATION
The random device implements the Yarrow pseudo random number generator algorithm and maintains its entropy pool. Additional entropy is fed
to the generator regularly by the SecurityServer daemon from random jitter measurements of the kernel. SecurityServer is also responsible
for periodically saving some entropy to disk and reloading it during startup to provide entropy in early system operation.
You may feed additional entropy to the generator by writing it to the random device, though this is not required in a normal operating envi-
ronment.
LIMITATIONS AND WARNINGS
Yarrow is a fairly resilient algorithm, and is believed to be resistant to non-root. The quality of its output is however dependent on regu-
lar addition of appropriate entropy. If the SecurityServer system daemon fails for any reason, output quality will suffer over time without
any explicit indication from the random device itself.
Paranoid programmers can counteract this risk somewhat by collecting entropy of their choice (e.g. from keystroke or mouse timings) and seed-
ing it into random directly before obtaining important random numbers.
FILES
/dev/random
/dev/urandom
HISTORY
A random device appeared in the Linux operating system.
Darwin September 6, 2001 Darwin