I'm trying to print in a more ordered way this input.
the input file is:
For some lines there are 2 related lines that contain "VLL VMI VKO VER" and in next line a corresponding value.
For example:
- The line where $4=730770 (header is ZW), has the value VLL=39 and VKO=5
- The line where $4=87477 has the value VLL=102, VMI=7 and VER=0-0
So, I would like to print this related values in the sale line when happens.
The output I'm looking for is like this:
I've was able to get this awk script but is far from desired output since basically is removing the lines with "VLL VMI VKO VER" and leaving the values in same place (in next line).
Thanks for the help. I noticed something I didn't considered. If I want to pass the output for example to Excel and I say the delimiter is space, the values for VLL, VMI, VKO, VER are located in wrong columns when for example VMI or VKO is empty in input file. Can be added an output delimiter to your solutions?
Sliding in an output delimiter is not a difficult task, but finding empty fields in the input when the input delimiters are a couple of spaces, and the input fields are space padded, too, is NOT a deterministic task. In this case, I'll take 5 spaces (two as field delimiters, three for field width) as an empty field identifier, but YMMV. Try
Sliding in an output delimiter is not a difficult task, but finding empty fields in the input when the input delimiters are a couple of spaces, and the input fields are space padded, too, is NOT a deterministic task. In this case, I'll take 5 spaces (two as field delimiters, three for field width) as an empty field identifier, but YMMV.
Thanks again RudiC. It works with the sample file but as you said different results could be obtained. Trying other input the output is not correct for some values of 4 last columns, but I understand the reason you explain. The input is not clearly determined in its fields so is difficult to parse it.
I think I could use your 3 solutions and manually separate the values in 4 last columns.
Many thanks for your help.
---------- Post updated at 01:37 PM ---------- Previous update was at 12:22 PM ----------
Hello RudiC,
May you explain me please how this part of your first solution works?
I understand with getline reads the next line after the matched string, but I don't see clear how if you already printed a line after the first getline, then why you apply another getline and a next and how you arrange the correct output with another print.
I want to have one .bash_profile works on multiple platform, ubuntu, debian, redhat, cygwin, osx. So how should I organize .bash_profile?
It can be multiple files in some subdir
Let me brief you:
what i want is a way to organize bash_profile across platforms so I can use one set of profiles... (2 Replies)
I'm attempting to write a script that will look into a directory, discover all unique names, create directories for their prefix names and place the files inside. I do this now one by one with a simple script but I'd like to automate the process.
The directory would contain something like: ... (6 Replies)
Hi Everyone !
i want to make an application which is written in shell script and in Bourne shell (sh)
i want, when my script is executed, it read all the files in the directly and move them to folders according to their extension.
suppose i have a files:
test.txt
test.jpg
test.docx... (1 Reply)
I'm looking for terminal programs, which organize and pretty code like HTML or JavaScript.
Thanks!
---------- Post updated at 07:01 AM ---------- Previous update was at 01:49 AM ----------
Found this Online javascript beautifier (1 Reply)
hello
i have written a multitask script which performs verifications on the server (RHEL 5 tikanga); based on list of rules.
since the results are huge both in length and number and I am sending them all to my log file.
Is there any method to organize the STATUS of my results in a defined... (1 Reply)
would like to standardize how we set envs on our unix box, so I thought a menu would be a great way to accomplish this.
The problem I'm experiencing, is the value is set...but ONLY during the time the menu is initiated.
please see below:
> /home/is/bin/r12MENU.sh
... (2 Replies)