10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
2. Shell Programming and Scripting
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)
Discussion started by: web2moha
5 Replies
3. Shell Programming and Scripting
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)
Discussion started by: Rabu
8 Replies
4. Shell Programming and Scripting
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)
Discussion started by: prvnrk
6 Replies
5. Shell Programming and Scripting
Code:
Using ksh
Var1=`awk -F";" {print $1}' Input2.txt`
cat Input1.txt | awk -F";" '{$3="Var1"}' > Output.txt (13 Replies)
Discussion started by: Roozo
13 Replies
6. Shell Programming and Scripting
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)
Discussion started by: karthikram
3 Replies
7. Shell Programming and Scripting
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)
Discussion started by: machomaddy
4 Replies
8. Shell Programming and Scripting
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)
Discussion started by: grossgermany
1 Replies
9. Shell Programming and Scripting
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)
Discussion started by: shashi1982
2 Replies
10. Shell Programming and Scripting
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)
Discussion started by: RacerX
5 Replies