Search Results

Search: Posts Made By: alpesh
2,029
Posted By vgersh99
something to start with. nawk -f alpesh.awk...
something to start with.
nawk -f alpesh.awk OFS='\t' myFile
alpesh.awk:

function rindex(str,c)
{
return match(str,"\\" c "[^\\" c "]*$")? RSTART : 0
}

/^[0-9][0-9]*/&&NF==1 {tp=1;next}
...
2,029
Posted By bakunin
This will be some work and it is going to become...
This will be some work and it is going to become complex. Let us address one problem after the other. I suggest to use sed for this sort of text manipulating tasks.

The general way of addressing...
2,029
Posted By Corona688
$ cat abstract.awk BEGIN { OFS="\t" } ...
$ cat abstract.awk

BEGIN { OFS="\t" }

/^[0-9]+[ \t]*$/ {
if(T) print T, A[1], A[2], ASTR, ABSTR;
getline T
}

/^Pages/ {
split($2, A, "-");

...
2,351
Posted By Scrutinizer
With your sample of 6 cols, try: awk 'gsub(FS...
With your sample of 6 cols, try:
awk 'gsub(FS $3,"&")<4' infile | sort -k2,2n -k1,1
(So 4 should be 230 for 232 cols..)



--
Please view this link...
2,451
Posted By rangarasan
awk
Loop increment is missing there, so that the infinite loop occurs. I posted through mobile, something went wrong... Sorry for the inconvenience:-)
change the code as suggested by Scrutinizer... It...
2,451
Posted By Scrutinizer
You need to set the output delimiter to TAB as...
You need to set the output delimiter to TAB as well (FS=OFS="\t")
2,451
Posted By rangarasan
bash
Hi,

Try this one,

cd path
for file in *
do
awk 'BEGIN{FS=":";}{$2="chr"$2;a[NR]=$0;}END{for(i=1;i<=NR;i ){print a[i] >FILENAME;}}' ${file}
done

this code snippet will update the...
2,451
Posted By methyl
It is quite difficult to work from faulty code...
It is quite difficult to work from faulty code (syntax error on line 1).
Please post sample before and after data and explain the process in more detail.

Please post what Operating System and...
4,434
Posted By radoulov
This code below should take care of this: ...
This code below should take care of this:

awk 'NR == FNR {
c = x
while (match($6, /[0-9]*[SM]/)) {
p1 = substr($6, RSTART + RLENGTH - 1, 1)
p1 == "M" && !c++ && t[$1, "S"]++
...
4,434
Posted By vgersh99
tr -d '\015' < myFile > myNewFile
tr -d '\015' < myFile > myNewFile
4,434
Posted By radoulov
Yes, this should do the trick: perl -i...
Yes, this should do the trick:

perl -i -pe's/\r\n/\n/g' file2_truncated.txt file1_truncated.txt
4,434
Posted By radoulov
1. Execute dos2unix file2_truncated.txt...
1. Execute dos2unix file2_truncated.txt file1_truncated.txt.
2. Try this and check the result:

awk 'NR == FNR {
f2[$1] = $10; next
}
$4 in f2 {
print $0, substr(f2[$4], $8 - $2 , $9 -...
4,434
Posted By radoulov
This is what I get with your files: awk 'NR...
This is what I get with your files:

awk 'NR == FNR {
f2[$1] = $2; next
}
$1 in f2 {
print $0, substr(f2[$1], $3 - $2, $4 - $3)
}' file2 file1% awk 'NR == FNR {
f2[$1] = $2; next
...
4,434
Posted By vgersh99
I'm not sure if 'START' position really matters -...
I'm not sure if 'START' position really matters - you're extracting from POS1 to POS2 anyway. Or are POS1 and POS2 relative to the START?
something along these lines - debug with a sample file1:
...
1,493
Posted By ctsgnb
Q1 : sed '1s/.*/& colC/;s/[][]//g;s/\.\./ /'...
Q1 :
sed '1s/.*/& colC/;s/[][]//g;s/\.\./ /' yourfile

Q2 :
$ for v in 24S45M67N45M 367M 23M3D34M
> do
> echo $v | nawk -F"M" '{gsub(/[0-9][0-9]*[^0-9M]/,z);print($1+0),($2+0)}'
> done
45 45...
Showing results 1 to 15 of 15

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