I have tried.... grep "IH:i:1" file.sam > filtered.sam
but this will also return "IH:i:11 IH:i:12" etc etc. I have also tried "IH:i:1 " which returns nothing (I believe it's tab delimited)
As you didn't post a sample of your file i am left to guessing, but no problem: just give me a moment while i inspect your file with my crystal ball....
OK, somehow the device must be broken, but i can still give you some pointers:
"grep" always searches for the expression you give it. "1" will find "1", but also "11", "12", "1blabla", etc.. The trick therefore is to make to expression longer, up to a point where all the wrong lines are excluded.
Having said this: if you are sure (instead of just guessing) that the expression is followed by a tab you could add this tab as part of the expression. grep accepts this, but you will have to enclose your expression in single quotes to protect it from the shell evaluation process. In the following "<TAB>" means a literal tab character:
You can verify the character following being a tab by opening the file in a "vi" editor and enter ":set list" to display all the non-printable characters. Tabs will be displayed as "^I".
In case you just don't want any digit to follow your expression you simply forbid that instead of trying to find out what follows your expression:
"[^0-9]" means "any character except numbers 0-9". The "[...]" means "any one character inside" and the "^" at the beginning reverses the meaning.
Hi! I'm trying to do this:
1 -
2 -
3 -
4 -
5 -
I'm using seq for this:
seq 1 20 > filename.txt
How do I get the "-"? I've tried -f per man but can't get anything to work. Also, is there an easier or better way than using sequence? Thanks! (6 Replies)
Greetings,
Using linux based OS and KSH.
I m trying to make a simple script to parse some logs to show a count per hour on a specific alarm starting from midnight to the current hour.
So I format my "HOUR" variable to show the current time and so I can use it in the following bit of code.... (6 Replies)
Assuming one does not have such luxuries as bash, zsh, jot, rs, perl, etc. what is the most elegant way to print out a formatted date series like this:
01-01-2010
01-02-2010
01-03-2010
...
02-01-2010
02-02-2010
...
Can I accomplish this with just basic shell builtins and seq, or... (3 Replies)
I usually just browse the forum/google for answers, however I've been stuck on a problem for a number of hours now and I've decided to join up and actually ask I've searched the forum ad naseum in an attempt to find answer to my query, however so far I have been unsuccessful.
I'm no expert... (3 Replies)
Hi all. Im trying to use a sequence in a while loop like this below. I need it for navigating a year, month, day folder structure where a user can input the start date and have it go to the desired end date. The script will grab a certain file on each day then move onto the next. Ive got all that... (3 Replies)
Hi guys. i have the following script:
1 #!/bin/bash
2 linkcount=$(grep "/portal" tickets | wc -l)
3 grep "/portal" tickets > links
4 for i in $(seq 1 $linkcount); do
5 echo "BLYAT"
6 let link$i=$(sed -n "$i"p links)
7 echo $
8 done
the problem is, that "let" can`t... (1 Reply)
Hi,
Normally, I will manually to use "ll" command to list the following file from \FILE\CACHE\ directory and check the jump seq. Can I write a script to loop or/and check jump seq file (if jumped seq and show "missing seq no" message for me)
-rw-rw----+ 1 user develop 14012 Sep 4... (1 Reply)