Search Results

Search: Posts Made By: andy391791
6,323
Posted By andy391791
Im sure there are better ways to do it but the...
Im sure there are better ways to do it but the following will work assuming that the amount of comma separated values in $10 and $11 are the same:

awk -F '\t'...
6,323
Posted By andy391791
What about this? awk -F '\t'...
What about this?

awk -F '\t' '{split($10,s1,",");split($11,s2,","); print $9,$13,$2,s1[1]"-"s2[1],s1[2]"-"s2[2]}' file

Output:

2 ACKR1 NM_002036.3 159173802-159174770 159175250-159176290
6,086
Posted By andy391791
Another awk solution awk '{if($1=="WARNING" &&...
Another awk solution
awk '{if($1=="WARNING" && $0==dup){next}} {print;dup=$0}' file
9,744
Posted By andy391791
Sed alternative sed -n...
Sed alternative

sed -n 's/.*\[\([0-9]\{23\}\)\].*/\1/p' filename
8,068
Posted By andy391791
Hi Rudi, would it be possible for you to explain...
Hi Rudi, would it be possible for you to explain how this script works? Im still learning awk and theres a lot i dont understand in this script?
Many thanks
7,901
Posted By andy391791
Sed alternative: echo "Insert completed. 100...
Sed alternative:

echo "Insert completed. 100 rows added" | sed 's/\([^[0-9]*\)\([0-9]*\)\(.*\)/\2/'
1,263
Posted By andy391791
Not sure exactly what you want to do with the...
Not sure exactly what you want to do with the output (maybe send an email ??) but the below script will search for the text and then if found send an email and then continue on from the last line...
1,746
Posted By andy391791
Hi, regarding code : awk...
Hi, regarding code :

awk '{gsub("\n[^\n]*/",","); sub(",","\n")}1' RS= ORS='\n\n' file

Would you be able to explain how this works as i cant understand it?

Many thanks
1,817
Posted By andy391791
Not sure how you are calling sqlplus, but sqlplus...
Not sure how you are calling sqlplus, but sqlplus -s will put it in silent mode and remove everything apart from the result
1,556
Posted By andy391791
i tried nawk this gives the same output. Is...
i tried nawk this gives the same output.

Is this problem exclusive to AIX?
1,556
Posted By andy391791
awk '{print $1 $2}' RS="\n\n" file1 and ...
awk '{print $1 $2}' RS="\n\n" file1

and

awk '{print $1 $2}' RS='\n\n' file1

both give wrong output:

line1
val1
val2

line2
val1
val2

line3
val1
val2
1,556
Posted By andy391791
Using quotes in awk
Hello, i had a problem running a script , and after investigation found its all to do with the quotes:

cat file1


line1
val1
val2

line2
val1
val2

line3
val1
val2

awk 'BEGIN...
1,655
Posted By andy391791
You can add OFS : awk...
You can add OFS :

awk 'FNR==NR{a[NR]=$2;next}{$2=a[FNR]}1' FS="^" OFS="^" /tmp/featureCodesAndCapacity /tmp/outputData
3,999
Posted By andy391791
If you did want the last field from file2 you...
If you did want the last field from file2 you could do the following:



awk 'NR==FNR{a[$1]=$2;next} $10 in a {print $10, a[$10],$7}' file2 file1

This would give output as


...
3,999
Posted By andy391791
Hi Mo, the desired output you have put does not...
Hi Mo, the desired output you have put does not match what you have specified, as
Parent=tRNA-Tyr6.r01 has a + in file1 but your desired output shows a -
Also you have put the last field from...
16,549
Posted By andy391791
Hi Made in Germany, i looked at your response and...
Hi Made in Germany, i looked at your response and im confused about the format of the statment

awk 'NR%2==0' RS='"' file

I understand its only printing even lines and the record separator is...
7,398
Posted By andy391791
Not sure if your specifications requires the...
Not sure if your specifications requires the quotations or not but what about:

awk '{print "\""$6,$7,$8"\"","\""substr($9,1,length($9)-4)"\""}' filename

Will produce:

"Jun 03 16:32"...
1,053
Posted By andy391791
Could you not just do: awk -F "=" ' {print...
Could you not just do:

awk -F "=" ' {print $2}' red

This will output:

50988 41498 45 0 0 0
1500
1
1,615
Posted By andy391791
ps -ef | grep abc.sh | grep -v grep If...
ps -ef | grep abc.sh | grep -v grep

If there is an entry then the job is still running

If there isnt then the job has completed
15,267
Posted By andy391791
When curly braces needed?
Hello, i was trying to find get a command to list duplicated files so i tried

ls dir1 dir2 | awk '{x[$0]++}'

and it didnt work.

After a bit of searching online i found that it works without...
1,949
Posted By andy391791
Don, absolutely no need to apologize ;many thanks...
Don, absolutely no need to apologize ;many thanks to you and the other posts for taking the time explaining this to me, it now makes sense !
1,949
Posted By andy391791
Hi, in the example below its printing less than...
Hi, in the example below its printing less than expected, not more:

echo "Date-range on 5th May is between -010516 and 050516- please continue "| sed 's/.*\(-.*-\).*/\1/'

output
-010516 and...
1,949
Posted By andy391791
Hi Don, thankyou very much for your time in...
Hi Don, thankyou very much for your time in explaining that to me.

However, after doing a bit of testing im still slightly confused and would like to understand :


"The -.*- between the...
1,949
Posted By andy391791
Hi , thanks for your replies. Both commands...
Hi , thanks for your replies.

Both commands work, and i understand fully the code

sed 's/.*\(-.*-\).*/\1/'

However i dont really understand how this works:

sed 's/.*\(-[^-]*-\).*/\1/'
...
1,949
Posted By andy391791
sed match
Hi can anyone help with the following:

echo "Date range on 5th May is between -010516 and 050516- please continue "| sed 's/\(.*-\)\(.*-\)\(.*$\)/\2/'

output

010516 and 050516-

What i...
Showing results 1 to 25 of 35

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