I have a file whose contents are as follows:
I wanted it to look like this
Basically I wanted to add a statement with the third column entry as predictive and the ID having only the id name without anything after the dot.
So for every statement for assumption,I need to add a statement with predictive.
So i used this code
However in my file, I have some instance where there are variants for the id name :For example One variant of id is f000012.1 and the other is f000012.2
this above code worked perfectly well for instance having no variants of IDS. But in case of variants,I am getting a multiple entry of predictive statement for the same ids.
result of the code
whereas what i needed should look like this
Is there a way I could only add a single line with predictive statement with using the earliest start point i e : and farthest away end point to represent the predictive statement?The ID name shouldnt have variants .
Last edited by Don Cragun; 02-17-2014 at 12:26 AM..
Reason: Change BOLD tags to CODE tags for sample code.
Thanks for the reply.
The script you gave didnt remove the multiple entry of predictive lines.
Basically I was looking for a command that would insert a predictive line for every assumption line and also look for ids which have variants and in case it finds variants ,it should represent the predictive line with start location representing the earliest start point in this eg it would be 350567 and farthest away end point 361011
Hello all
I have a statement :
ARRAY_MOUNT_POINT_NAME=`df -h | awk '{print $6}'| head -`expr $i+2` |tail -1`
when the value of i=0 , I want the head argument to be at -2 . Using the expr statement isnt working.
Help ! (5 Replies)
Hi all,
I am trying to write a code for addition of n numbers which will be passed by the user as command line arguments.
I wrote the following code.
add=0
for (( i = 1 ; i <= $# ; i++ ))
do
add=`expr $i + $add`
done
#echo "sum is : $add"
input :
$./add.sh 12 32 14... (7 Replies)
whats wrong with this addition?
Whats the maximum number of digits can be handled?
pandeeswaran@ubuntu:~/Downloads$ const=201234454654768979799999
pandeeswaran@ubuntu:~/Downloads$ let new+=const
pandeeswaran@ubuntu:~/Downloads$ echo $new
-2152890657037557890
pandeeswaran@ubuntu:~/Downloads$ (4 Replies)
I have a data file in the format of
1234 xxx
1234 xxx
1234 xxx
1234 xxxI want to be able to calculate the following -
COLUMN1+((LINENUMBER-1)/365)
The output needs to preserve the 2nd column -
1234 xxx
1234.00274 xxx
1234.00548 xxx
What is the best way to do this? I am somewhat... (9 Replies)
a=10.00
pattern=-11.00
b=`echo "$a $pattern" | awk ' printf("%d\n", $1 + $2)'`
echo $b
not working, also trined bc ,dc but thats not on my m/c.
also expr not supporting.
any clue? (6 Replies)
Hi all,
I am very new to shell programming and trying to learn out the basics.
I tried this:
$ echo `expr 20 + 30`
and it worked. But when i tried this,it does not work.
$ a=20
$ b=30
$ echo `expr a + b`
The error is:
expr: non-numeric argument
I cant understand why its... (3 Replies)
Hi all,
I am getting following output by using commands like sort, uniq and awk to the standard output.
110 d
40 a
59 c
9 b
3 e
Now at the end I would like to add all the numbers in column 1 and display the count of all numbers i.e. (110 + 40 + 59 + 9 + 3).
Also the output may... (3 Replies)
I add up the number of args that are not blank. It works, but the printout is a string that just keep concatenating on +1. So Ex. it goes through input of: bob toto " " tom ...I get 0+1+1+1, when all I want is 3. Any help is appreciated.
count=0
for name in $*
do
if ; then
... (3 Replies)