Visit The New, Modern Unix Linux Community

Search Results

Search: Posts Made By: evelibertine
685
Posted By bartus11
Try:awk '{for (i=2;i<=NF;i+=3) printf...
Try:awk '{for (i=2;i<=NF;i+=3) printf ($i+$(i+1))/2" ";printf "\n"}' file
1,419
Posted By rdrtx1
try: awk '$2 == "NA" {$2=$1":"$4} 1' OFS="\t"...
try:
awk '$2 == "NA" {$2=$1":"$4} 1' OFS="\t" infile
960
Posted By hiten.r.chauhan
Just enclose the file name variable in double...
Just enclose the file name variable in double quotes as below:


for i in {1..100}; do cut -f1 "data_$i.txt" > "output$i.txt"
971
Posted By hanson44
If I understand what you are trying to do, try...
If I understand what you are trying to do, try this:
for i in {1..10}; do awk '{$3=i; print}' i=$i data$i.txt > output$i.txt; done
6,138
Posted By Yoda
Please note that variable expansion happens only...
Please note that variable expansion happens only inside double quotes not single quotes.
799
Posted By Yoda
awk ' { gsub(/.*\(|\).*/,x) } 1' file
awk ' { gsub(/.*\(|\).*/,x) } 1' file
986
Posted By Yoda
awk '$1!=$2{$4=$4*2}$1==$2{$4=$4*2+1}1' file
awk '$1!=$2{$4=$4*2}$1==$2{$4=$4*2+1}1' file
1,141
Posted By Yoda
awk 'f==$1&&s!=$2{print c;print}{f=$1;s=$2;c=$0}'...
awk 'f==$1&&s!=$2{print c;print}{f=$1;s=$2;c=$0}' file
3,345
Posted By user8
If I understood correctly, you could try this: ...
If I understood correctly, you could try this:

awk '$2>($6-1000000) || $2<($7+1000000)'

While thinking twice, I came to the conclusion that the above should better read

awk '$2>($6-1000000)...
2,814
Posted By Corona688
Standard tool, then. Even ordinary awk can...
Standard tool, then.

Even ordinary awk can handle this if you fiddle with the record and field separators so it reads one column at a time, what to do with it is the question. Millions of columns...
2,814
Posted By RudiC
I'm not sure any tool will handle lines at least...
I'm not sure any tool will handle lines at least 4 million chars long (one char cols assumed). Where do these loooong lines come from? A database? Can't they be created in a different way from the...
2,814
Posted By Corona688
Does the first column have a fixed width?
Does the first column have a fixed width?
2,814
Posted By Corona688
Some more information on the file would be nice,...
Some more information on the file would be nice, too. Do the columns have a maximum width? Or better yet, a fixed width?
2,814
Posted By bakunin
The correct procedure involves candles, the...
The correct procedure involves candles, the sacrifice of rum, tobacco and a living chicken, then invoking the following ritual chant ....

Seriously: if we are supposed to help you with a problem...
2,814
Posted By Corona688
Transpose into what? Vice versa?
Transpose into what? Vice versa?
1,848
Posted By Vi-Curious
:%s/<space>/<tab>/
:%s/<space>/<tab>/
966
Posted By Scrutinizer
Try: awk '{if(NF==1)$0=p FS $0; else p=$1 FS...
Try:
awk '{if(NF==1)$0=p FS $0; else p=$1 FS $2}1' file
1,082
Posted By Scrutinizer
awk '{s=$1; for(i=$2; i<=$NF; i++) s=s OFS i;...
awk '{s=$1; for(i=$2; i<=$NF; i++) s=s OFS i; print s}' file
1,082
Posted By Yoda
awk '{ printf "%d ",$1; j=$2; while(j<=$NF) {...
awk '{ printf "%d ",$1; j=$2; while(j<=$NF) { if(j==$NF) { printf "%d\n",j; j++; } else { printf "%d ",j; j++; } } }' filename
1,305
Posted By Scrutinizer
Try: awk '{$3=0 OFS $3}1' file
Try:
awk '{$3=0 OFS $3}1' file
3,145
Posted By elixir_sinari
Assuming that your lines_file contains each line...
Assuming that your lines_file contains each line number on a separate line (and that you don't want to consider duplicate line numbers, if they exist):
awk 'FNR==NR{a[$1];next}FNR in a' lines_file...
1,297
Posted By Yoda
sort -k4,4gr input.txt
sort -k4,4gr input.txt
815
Posted By vgersh99
awk '{$2=$2<=3?"LOW":($2<=6)?"HIGH":"UNKNOWN")}1'...
awk '{$2=$2<=3?"LOW":($2<=6)?"HIGH":"UNKNOWN")}1' file
1,345
Posted By alister
And that's the really long version :) ...
And that's the really long version :)

Regards,
Alister
1,345
Posted By Yoda
awk ' { if($1 != $2) print; } ' infile
awk ' { if($1 != $2) print; } ' infile
Showing results 1 to 25 of 94

 

Featured Tech Videos

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