Search Results

Search: Posts Made By: evelibertine
1,377
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
4,694
Posted By rdrtx1
try: awk '$2 == "NA" {$2=$1":"$4} 1' OFS="\t"...
try:
awk '$2 == "NA" {$2=$1":"$4} 1' OFS="\t" infile
1,426
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"
1,916
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
16,045
Posted By Yoda
Please note that variable expansion happens only...
Please note that variable expansion happens only inside double quotes not single quotes.
1,127
Posted By Yoda
awk ' { gsub(/.*\(|\).*/,x) } 1' file
awk ' { gsub(/.*\(|\).*/,x) } 1' file
1,443
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,599
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
7,442
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)...
4,583
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...
4,583
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...
4,583
Posted By Corona688
Does the first column have a fixed width?
Does the first column have a fixed width?
4,583
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?
4,583
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...
4,583
Posted By Corona688
Transpose into what? Vice versa?
Transpose into what? Vice versa?
3,637
Posted By Vi-Curious
:%s/<space>/<tab>/
:%s/<space>/<tab>/
1,662
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,735
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,735
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,725
Posted By Scrutinizer
Try: awk '{$3=0 OFS $3}1' file
Try:
awk '{$3=0 OFS $3}1' file
8,322
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...
2,364
Posted By Yoda
sort -k4,4gr input.txt
sort -k4,4gr input.txt
1,240
Posted By vgersh99
awk '{$2=$2<=3?"LOW":($2<=6)?"HIGH":"UNKNOWN")}1'...
awk '{$2=$2<=3?"LOW":($2<=6)?"HIGH":"UNKNOWN")}1' file
2,857
Posted By alister
And that's the really long version :) ...
And that's the really long version :)

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

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