Search Results

Search: Posts Made By: Gussifinknottle
1,179
Posted By RudiC
To test for first THREE columns as specified, try...
To test for first THREE columns as specified, try
awk '{IX = $1 $2 $3} FNR == NR {T[IX] = $0; next} !(IX in T)' file2 file1
1,444
Posted By jim mcnamara
It looks like you are using bash - the array...
It looks like you are using bash - the array declaration is correct.
The the full syntax is:
declare -a myArray=( value1 value2 value3 )

for i in ${myArray }; do printf "%s\t" $i; done

Note...
1,444
Posted By RudiC
With bash, try this:IFS=$'\t'; printf "%s\n"...
With bash, try this:IFS=$'\t'; printf "%s\n" "${myArray
}"
fgh ijk xyz abcPlease note that you'll need to save IFS before and restore it later.
4,906
Posted By cjcox
${x}_1
${x}_1
8,251
Posted By Yoda
awk '$4!="A"{$4=$2$3;}$4=="A"{$4=$3$3;}1'...
awk '$4!="A"{$4=$2$3;}$4=="A"{$4=$3$3;}1' OFS="\t" infile
3,051
Posted By neutronscott
I see a pattern here. If you were going to merge...
I see a pattern here. If you were going to merge t1,t2,t3 afterwards anyway..


awk -F'\t' '{print $1,$2,$4,$5,$NF}' OFS="\t" input


edit: ok maybe this simplification won't work if the...
3,051
Posted By Corona688
If these files are separated with single spaces...
If these files are separated with single spaces or tabs, awk may take the multiple whitespaces to be one field. You can fix this by overriding the FS variable with a single tab.

I'd just do...
2,693
Posted By Corona688
paste t1 t2 | awk -v OFS="\t" '{ (NF>M) && M=NF;...
paste t1 t2 | awk -v OFS="\t" '{ (NF>M) && M=NF; for(N=1; N<=M; N++) length($N) || $N="NaN" } 1'

1 2 3 4 5 6 7 8
1 2 3 4 5 ...
6,977
Posted By itkamaraj
sed -i "s/$a/$b/g" Master
sed -i "s/$a/$b/g" Master
6,545
Posted By jgt
a=2.165 b=3.234 c=`echo $a \* $b|bc` ...
a=2.165
b=3.234
c=`echo $a \* $b|bc`

Read more about bc if you want greater precision in the product
2,501
Posted By Corona688
Substitution doesn't happen in single-quotes, no,...
Substitution doesn't happen in single-quotes, no, even if you surround it by double quotes. You have to end the single quotes in an ugly mess like

$2>="'"$i"'" && $2 <="'"$j"'" This has an...
2,934
Posted By drl
Hi. Adapt as needed: #!/usr/bin/env bash ...
Hi.

Adapt as needed:
#!/usr/bin/env bash

# @(#) s1 Demonstrate successive slices of file.

FILE=${1-data1}

n=$( wc -l < $FILE )
echo " Info: processing $n lines of $FILE"
for ((...
5,616
Posted By Ygor
Just set OFS...awk '...' OFS='\t' file1
Just set OFS...awk '...' OFS='\t' file1
5,616
Posted By Ygor
With the given example...$ cat file1 100 A 105...
With the given example...$ cat file1
100 A 105 B
200 B 205 C
300 C 305 D
400 D 405 E
500 E 505 F

$ awk 'BEGIN{n=split("A B C D E",s);split("1 2 3 4...
3,675
Posted By Franklin52
You can use variables like this: awk -v...
You can use variables like this:
awk -v var1="TP" -v var2="10" -v var3="100" '
$2==var1 && $3 >= var2 && $3 <= var3' inputFile > PatternFile
2,567
Posted By anurag.singh
Use TAB space instead of single space ...
Use TAB space instead of single space
old=${line%%<TAB>*}
new=${line##*<TAB>}
6,166
Posted By Corona688
This is much better done in a 'while' than 'for'...
This is much better done in a 'while' than 'for' loop.

The read builtin by default breaks on all whitespace, tabs included. To break on only tabs, set the IFS variable to a tab.
while read A B...
1,992
Posted By jim mcnamara
csplit is for you. Read your documentation. ...
csplit is for you. Read your documentation. /^2/ is the regular expression you need. See what you can come up with. We will help when you come back with questions.
Showing results 1 to 18 of 18

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