10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.
I've tried to do this with a while loop, but instead of printing the prefix I print the first line of the file twice.
Files:... (3 Replies)
Discussion started by: pathunkathunk
3 Replies
2. Shell Programming and Scripting
Hello:
I want to print out the even number of fields plus the first column as row identifiers.
input.txt
ID X1 ID X2 ID X3 ID X4
A 700 A 1200 A 400 A 1300
B 2000 B 1000 B 2000 B 600
C 1400 C 200 C 1000 C 1200
D 1300 D 500 D 600 D 200and the output is:
output.txt
ID X1 X2 X3... (3 Replies)
Discussion started by: yifangt
3 Replies
3. Shell Programming and Scripting
I have the following awk script that looks at the first 2 columns of multiple files and when they match, it prints the min of the 3rd column.
for year in tave-{1950..2015}.txt
do
cat "$year"
done |
awk '{n=$3; $3=x} !($0 in A) || n<A {A=n} END{for(i in A) print i A}' > output.txt
... (3 Replies)
Discussion started by: ncwxpanther
3 Replies
4. Shell Programming and Scripting
I have test.sh file as below :
set -A IDARR $ID
echo | awk -f test.awk -v TempArr="${IDARR
}"
I have test.awk file as below :
BEGIN {
Flag = 1;
}
{
print "Hello";
for(i in TempArr)
{
print i;
}
} (9 Replies)
Discussion started by: nes
9 Replies
5. Shell Programming and Scripting
Hi,
I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1).
Input:
919143110065
919143110065
919143110052
918648846132
919143110012
918648873782
919143110152
919143110152
919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies
6. UNIX for Advanced & Expert Users
Hello,
I have a data file with 300,000 records in it, and another file which contains only the line numbers of roughly 13,000 records in the data file which have data integrity issues. I'm trying to find a way to print the original data by line number identified in the second file. How can I do... (2 Replies)
Discussion started by: peteroc
2 Replies
7. Shell Programming and Scripting
Dear all,
I am using awk to filter some data like this:-
awk 'NR==FNR{a;next}($1 in a)' FS=":" filter.dat data.dat >! out.dat where the filter and input data look like this:-
filter.dat...
n_o00j_1900_40_007195350_0:n_o00j_1940_40_007308526... (3 Replies)
Discussion started by: atb299
3 Replies
8. Shell Programming and Scripting
Dear All,
a.txt
A 1 Z
A 1 ZZ
B 2 Y
B 2 AA
how can i use awk one line to achieve the result:
A Z|ZZ
B Y|AA
Thanks (5 Replies)
Discussion started by: jimmy_y
5 Replies
9. Shell Programming and Scripting
Hi,
i have a file with content
00:01:20.613 'integer32' 459254
00:01:34.158 459556
00:01:36.626 'integer32' 459255
and i want to print only output as below
00:01:20.613 459254
00:01:34.158 459556
00:01:36.626 459255
i dont want the word 'integer32' which is the second column.
i... (2 Replies)
Discussion started by: dealerso
2 Replies
10. Shell Programming and Scripting
hi,
i have store variable in $var i want to print it in $3 of file using awk.
how can i do it?
file :
var1,var2,var3
var5,var6,var7
var8,var9,var10
.
.
.
i want to print $var in $3 ( for example var3 or var7 or var10)
thanks (3 Replies)
Discussion started by: kamel.seg
3 Replies