Merging files with AWK filtering and counting lines
Hi there,
I have a couple of files I need to merge. I can do a simple merge by concatenating them into one larger file.
But then I need to filter the file to get a desired result.
The output looks like this:
and the filtering should leave the first and the last line with the TRNH and TRLR (giving the last TRLR the same sequence as the first TRNH). The rest of the TRNH and TRLR lines need to be omitted.
Then the final TRLR should represent the amount of ORDH lines and the amount of OADR, OMSG and ORDL lines.
I haven't gotten to deleting the extra TRNH and TRLR lines yet; this is the filter I have so far:
Now the amount of ORDH lines is output to my new file, so that seems to work. Yet the amount of OADR, OMSG and ORDL lines isn't corrected in the output.
Hi,
I am attempting to merge the following lines which run over two lines using awk.
INITIAL OUTPUT
2019 Sep 28 10:47:24.695 hkaet9612 last message repeated 1 time
2019 Sep 28 10:47:24.695 hkaet9612 %ETHPORT-5-IF_DOWN_INTERFACE_REMOVED: Interfa
ce Ethernet1/45 is down (Interface removed)... (10 Replies)
Hello all,
I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person.
In the csv, a person may be listed from one to four times... (9 Replies)
I want to count lines of a file using AWK (only) and not in the END part like this awk 'END{print FNR}' because I want to use it.
Does anyone know of a way?
Thanks a lot. (7 Replies)
Experts Good day,
I want to filter multiple lines of same error of same day , to only 1 error of each day, the first line from the log.
Here is the file:
May 26 11:29:19 cmihpx02 vmunix: NFS write failed for server cmiauxe1: error 5 (RPC: Timed out)
May 26 11:29:19 cmihpx02 vmunix: NFS... (4 Replies)
Hi everyone,
I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines).
Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
I've never toyed with awk, but it seems every time I present an elegant 2- to 8-line script, someone comes back with an awk 1-liner.
I just came up with this to count all the lines of source code in a directory. How would I do it in awk?
LINES=0
for n in $(wc -l *.cpp *.h | cut -b-7); do
... (2 Replies)
Hi,
Im trying to create a script that reads throught every line in a file and then counts how many lines there with a certain field that matches a input, and also ausing another awk it has to do the same as the above but to then use sort anduniq to get rid of all the unique lines with another... (8 Replies)
Hi,
Anybody help on this. :(
I want to merge the line with previous line, if the line starts with 7.
Otherwise No change in the line.
Example file aa.txt is like below
122122
222222
333333
734834
702923
389898
790909
712345
999999
My output should be written in another file... (6 Replies)
Hi experts,
First of all thanks for all your help.
How can i count the lines within a text file and send this number to another text file?
And by the way how can i count the number of files inside a tape ("/dev/rtp") that as one pattern (Ex. "/CTA/") and send this number to a text file?
I... (6 Replies)