Search Results

Search: Posts Made By: Behrouzx77
1,474
Posted By RudiC
You could use {X2[FNR]=$1; NR2=FNR} in my...
You could use {X2[FNR]=$1; NR2=FNR} in my previous post.
1,474
Posted By RudiC
Well, try this:awk 'FNR==NR...
Well, try this:awk 'FNR==NR {X1[FNR]=$1;NR1=FNR;next}
{X2[FNR]=$1}
END {for (i=1;i<=NR1;i++) print "X1: ", X1[i],",\tX2: ", X2[i], i; for (i=NR1+1;i<=FNR;i++) print "X1:\t,\tX2: ",...
1,474
Posted By rdrtx1
try: awk ' BEGIN{print"//start";P=0} ...
try:
awk '
BEGIN{print"//start";P=0}

{X1[NR]=$1;Y1[NR]=$2;Z1[NR]=$3; getline < f;
X2[NR]=$1;Y2[NR]=$2;Z2[NR]=$3;}
' f=file2 file1
1,178
Posted By rdrtx1
try: awk ' {sub(" *$",""); sub("^ *","");...
try:
awk '
{sub(" *$",""); sub("^ *",""); l=l":"$0; }
/add/ {if (b[l]) {l=""; next;} else {a[c++]=l; b[l]=l;};l=""}
END {
for (i=0; i<c; i++) {
sub("^:", "", a[i]);
gsub(":", "\n",...
20,878
Posted By kristinu
Here is another example, saving $1 in array val ...
Here is another example, saving $1 in array val

FNR == NR {
/>/ && idx[FNR] = ++i
$2 || val[i] = $1 # Store source location
next
}
20,878
Posted By RudiC
If you are talking shell array, try this. Syntax...
If you are talking shell array, try this. Syntax will vary from shell to shell, this one is bash (index starting at 0):$ X=($(awk '{print $1}' file))
$ echo ${#X[@]} #...
20,878
Posted By ctsgnb
Just an example (to be adapted depending on your...
Just an example (to be adapted depending on your needs)

$ awk '{X[NR]=$1;Y[NR]=$2}END{print X[2]"\n"Y[10]}' input
32783
29

NR stand for Number of Record since the RS (Record Separator) is the...
5,319
Posted By RudiC
Well, try awk -F/ '{print >>$3".txt"; ++cnt[$3]} ...
Well, try awk -F/ '{print >>$3".txt"; ++cnt[$3]}
END {for(fn in cnt) printf "%3d %s.txt\n", cnt[fn], fn}
' OFS="/" file > fname_distrib.txt
cat fname_distrib.txt
1 jtagc.txt
...
5,319
Posted By pamu
try awk -F/ '{print...
try

awk -F/ '{print >>$3".txt";x[$3]++}END{for(i in x){print i" "x[i] > "all_files.txt"}}' OFS="/" file
5,319
Posted By pamu
You don't need to use >> here > will do the...
You don't need to use >> here > will do the purpose...:)
5,319
Posted By RudiC
OK, so you want all lines that contain "jtagc" in...
OK, so you want all lines that contain "jtagc" in the file "jtagc.txt" and so on, no lines retained in the original file. Then try awk -F/ '{print >>$3".txt"}' OFS="/" fileYou may need to...
5,319
Posted By Franklin52
Or maybe: awk -F/ '{print $3 > $3 ".txt"}'...
Or maybe:
awk -F/ '{print $3 > $3 ".txt"}' infile
5,319
Posted By RudiC
Let me expand Scrutinizer's suggestion:awk -F/...
Let me expand Scrutinizer's suggestion:awk -F/ '{print $3>$3".txt"; $3="";print}' OFS="/" file
5,319
Posted By Scrutinizer
What about: awk -F/ '{print $3}' infile or do...
What about:
awk -F/ '{print $3}' infile
or do you mean to sort it:
sort -t/ -k3,3 infile
Showing results 1 to 14 of 14

 
All times are GMT -4. The time now is 08:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy