Manipulate all rows except header, but header should be output as well
Hello There...
I have a sample input file ..
I will be doing some manipulations on all the records except the header, but the header should always be at the top in the output. I want the file to be sorted (asc order on 1st field) and add 1000 as bonus to the field 3 (e.g. 125.23 + 1000).
I tried below:
awk 'BEGIN{FS=OFS=":"}{if( NR != 1){$3+=1000}print}' file
How can I sort the file? I know I could use sort but how can I sort all rows except the header and header should appear in sorted output?
I am thinking of doing something like this sort file | awk...
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... (3 Replies)
Hi,
I have a requirement to format the data in a new order. Here is my source format :
ppp ***Wed Dec 16 10:32:30 GMT 2015
header1 header2 header3 header4 header5
server1 0.00 0.02 0.07 0.98
server2 0.01 0.00 0.08 0.79
server3 0.05 0.82 0.77 0.86
... (18 Replies)
I am trying to match $1-$7 between the two files and if a match is found then the contents of $8 in file2 and copied over. The awk I tried is below. There is also a header row in file2 that has the Chr Start End Ref Alt that does not need to be searched. Thank you :).
awk
awk... (3 Replies)
I want to put the 3 first lines into a single line separated by ;
I've tried to use Sed and Awk but without success. I'm new to Shell scripting.
Thanks in advance!
Input
112
DESAC_201309_OR_DJ10
DJ10
1234567890123;8
1234567890124;20
1234567890125;3
expected Output... (8 Replies)
Hi,
I have an input like this
1 2 3 4
2 3 4 5
4 5 6 7
I would like to count the no. of columns and print a header with a prefix "Col".
I would also like to count the no. of rows and print as first column with each line number with a prefix "Row"
So, my output would be
... (2 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)
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)
I would like to remove some lines from begining of file (header) and some lines from end of file (footer).
The header/footer lines generated by web-browser when the user upload a file to my webserver.
Example:
-----------------------------7d62af20c052c
Content-Disposition: form-data;... (2 Replies)