files merges fine, but I need replace file 1.csv values of fields $4,$5,$6 with values $4,$5,$6 from file 2.csv, other fields from $7... must be untouched.
I've got a file with each record on a separate line and each record contains 34 fields separated by a colon and i'm trying to re-arrange the order of the fields and merge together certain fields separated by a slash (like field7/field28). I tried using an awk print statement like
awk -F: 'BEGIN... (5 Replies)
hi,
i am facing a problem in merging two files using awk,
the problem is as stated below,
file1:
A|B|C|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|DD|EE|FF|GG|HH|II|1
....
....
....
file2 :
1|Mn|op|qr (2 Replies)
Hi suppose I have a csv file like this
count,1977,1978,1979
usa, , , blue
japan, red, yellow,green
india, , yellow,blue
china, blue, yellow, green
I want the output to be(replace everything, including empty data, with the most recent data):
... (1 Reply)
Hi,
Say I have a record "1|22| | |". In which the third and fourth fields are <space> alone. I have to replace the <Space> with <null>.
Input:
"1|22| | |" --> "1|22|<space> |<space> |"
Expected output:
"1|22|||" --> "1|22|<null> |<null>|"
I tried:
echo "1|22| | |" | awk -F... (4 Replies)
Hi,
Please excuse for often requesting queries and making R&D, I am trying to work out a possibility where i have two files field separated by pipe and another file containing only one field where there is no matching columns, Could you please advise how to merge two files.
$more... (3 Replies)
Hello expert friends,
I'm writing a script to capture stats using sar and stuck up at report generation.
I have around 10 files in a directory and need to merge them all vertically based on the time value of first column (output file should have only one time value) and insert comma after... (6 Replies)
Hello, I have the following input file:
1 3 3 2
3 3 4 0
4 0 5 4
5 2 2 0
5 3 4 0
6 0 3 2
I am trying to remove all zeroes in fields 2 and 4 and replace them with "1's"
I tried the following, but it's not working
awk -F"\t" '{ if (($2==0) || ($4==0) $2=1; $4=1; print $0 ) }' input
... (8 Replies)
Hi,
From a file, using:
awk -F" " '{ if (NF == 6) print $1, $2, $3, $4, $5, $6; if (NF == 5) print $1, $2, $3, $4, $5; }'
i printed out the required output. But i'm trying to merge the columns. Please look at the desired output. Any suggestions? Thanks
Output:
00015 PSA1 ... (5 Replies)
Hello,
I'm back again looking for your precious help-
This time I need to merge two text files with matching two fields, output only common records with mixed output.
Let's look at the example:
FILE1
56153;AAA0708;3;TEST1TEST1;
89014;BBB0708;3;TEST2TEST2;
89014;BBB0708;4;TEST3TEST3;
... (7 Replies)
Discussion started by: emare
7 Replies
LEARN ABOUT REDHAT
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)