Hi Experts,
I am trying to get the output from a matching pattern but unable to construct the awk command:
file :
Code:
aa bb cc 11
dd aa cc 33
cc 22 45 68
aa 33 44 44
dd aa cc 37
aa 33 44 67
I want the output to be : ( if $1 match to "aa" start of the line,then print $4 of that line, and if $1 matches to "dd" of start of that line then print $4 of that line)
I am trying to print columns from a table whose name (header) matches a certain string.
Hello everybody,
I would like to ask you, how to print first and last row from input (not file).
Hello,
I am using AWK in UBUNTU 12.04.
I have a dataset as follows:
Code:
1 2 12 1 4 1 4 1 7 9 4 6
1 2 4 5 7 8 45 7 4 5 7 5
What I want to do is to add the values of some columns to each other and print it in the same file as the new column while omitting the previous two columns to have output as follows as an example:
1+4+4=9 2+1+6=9
So:
Code:
9 9 12 1 4 1 7 9
53 14 4 5 7 8 4
Hi group,
Can you please tell how to delete specific columns from a file.
I know something like
Code:
awk -F, '{ print $1" "$2" "15 }' input.txt > output.txt
will delete all other columns. But this is in a way to copy some particular columns.
But is there any other way to select just some columns to delete?
Thanks
Mitra
Hi,
I want to append "chr" to all col 2 values of all files in a particular folder.
This is what I came up with but isnt working.
I've a text file with below values viz. multiple rows with same values in column 3, 4 and 5, which need to be considered as duplicates. For all such cases, the rows from second occurrence onwards should be modified in a way that their values in first two columns are replaced with values as in first occurrence.
Hi,
i can print 2nd, 4th and 6th columns in a file using the shell command:
awk -F "|" '{print $2 $4 $6}' file1.txt
Now, the position and number of columns can be variable and from a variable POSLIST
So let's say
POSLIST='$2 $4 $6'
when i use the command:
a)
awk -F "|" '{print $POSLIST}' file1.txt
it throws the error:
awk: Field $() is not correct.
b)
awk -v VAR=$POSLIST
Hi,
Below is starting entry of my script
#!/bin/ksh
Usage()
{
print "Usage: $0 ID OPTION SERVER"
print "<br>Where :"
print "<br>Enter your ID into PARAM1, OPTION in the PARAM2 and SERVER in the PARAM3 field"
print "<br>ID should be a valid ID"
print "<br>OPTION should be either BOUNCE or STATUS"
print &q