Formatting problem with cat, egrep and perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Formatting problem with cat, egrep and perl
# 1  
Old 02-09-2010
Formatting problem with cat, egrep and perl

Hi guys I'm using the following script to change input file format to another format. some where I'm getting the error. Could you please let me know if you find out?

Code:
cat input.txt|egrep -v ‘^#'|\ perl -ane ‘if (@F>3){$_=~/(chr.+):(\d+)\ s([F|R])/;print $1,”\t”,$2,”\t”,($2+35),”\n”}'\ > output.bed

error
Code:
bash: syntax error near unexpected token `('



---------- Post updated 02-09-10 at 12:06 AM ---------- Previous update was 02-08-10 at 11:44 PM ----------

Thanx guys. I figured it out. Some extra spaces...
# 2  
Old 02-09-2010
Quote:
Originally Posted by repinementer
Hi guys I'm using the following script to change input file format to another format. some where I'm getting the error. Could you please let me know if you find out?

Code:
cat input.txt|egrep -v ‘^#'|\ perl -ane ‘if (@F>3){$_=~/(chr.+):(\d+)\ s([F|R])/;print $1,”\t”,$2,”\t”,($2+35),”\n”}'\ > output.bed

error
Code:
bash: syntax error near unexpected token `('

[COLOR="#738fbf"]

There's an illegal backslash after the pipe. (The backslash is unnecessary even if the perl command is on the next line.)

You should use ', not ‘ and '

Also, UUOC.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Egrep problem

Hi everyone, Can someone look this over? find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 \ -exec egrep -c 'TNS-12535: TNS:operation timed out' '{}' '+' | awk -F: '{print $1}' | egrep -c '2015-01-22' usidp/trace/abcdef_d001_21751.trc:9 \... (1 Reply)
Discussion started by: bdby
1 Replies

2. Shell Programming and Scripting

Problem with egrep and cat

Hello, I want to find some keywords in a dd image. I have created a keyword file (1.txt) and search the dd image using, cat /media/sdb1/test/c.dd.001 | strings | egrep -i --color -f 1.txt It works, But how can I get the file name and path? Many thanks. (7 Replies)
Discussion started by: yzy9951
7 Replies

3. Shell Programming and Scripting

sed and egrep in perl

Hi i have a data file whcih contains the data as follows : FH332OY86|AAABBB CCCC DDDA FHLMC 30 8.000|FHLMC|3|30|8.00000000|1986|26.29164289|3.29544844|0.00000000|10.05940539|107.50704264|Mar 8 2013 12:00AM|20130311|D|DA|DAA|DAAC|201302 FH332OY87|AAABBB CCCC DDDA FHLMC 30... (9 Replies)
Discussion started by: ptappeta
9 Replies

4. Shell Programming and Scripting

problem using CAT command in PERL

Hi All, I was trying to run the cat command using perl SCRIPT for my daily reports. However cat command is not working in PERL. please help me. cat FILE1.txt |cut -d "|" -f1 >INPUT1.txt cat FILE2.txt|wc -l *9111*|>INPUT2.txt paste INPUT1,INPUT2 >OUTPUT.txt Thanks in advance ... (3 Replies)
Discussion started by: adaleru
3 Replies

5. Shell Programming and Scripting

running egrep in perl script ?

Hi there if i run this from the BASH command line, i get a good result # FS="my-box23/account" # zfs list -t filesystem -H | cut -f1 |egrep "^ZPpool1/$FS$" ZP0pool1/my-box23/account which is great, however if I try to run in a perl script populating an array with the result/s, i get... (4 Replies)
Discussion started by: rethink
4 Replies

6. Shell Programming and Scripting

Perl or awk/egrep from big files??

Hi experts. In one thread i have asked you how to grep the string from the below sample file- Unfortunately the script did not gave proper output (it missed many strings). It happened may be i did gave you the proper contents of the file That was the script- "$ perl -00nle'print join... (13 Replies)
Discussion started by: thepurple
13 Replies

7. Shell Programming and Scripting

egrep problem

Hello Experts, I am trying to parse a gz file like this gzip -cd filename | xargs egrep -h -e '.*somepattern</TAG>' | grep -c '<TAG2>`date '+%Y-%m-%d'`</TAG2>' But I am getting an error : egrep cant open. Any ideas fellas? (1 Reply)
Discussion started by: King Nothing
1 Replies

8. Shell Programming and Scripting

egrep understanding problem

Hi, Can anyone please let me know the meaning of this line,i am not able to understand the egrep part(egrep '^{1,2}).This will search for this combination in beginning but what does the values in {}signifies here. /bin/echo $WhenToRun | egrep '^{1,2}:$' >/dev/null (1 Reply)
Discussion started by: namishtiwari
1 Replies

9. UNIX for Advanced & Expert Users

Problem with cat with PERL Substitute

system("cat FILENAME | perl -e 'while(<>) { print $_;}'"); system("cat FILENAME | perl -e 'while(<>) { $_ =~ s/XXX/YYY/g; print $_;}'"); First command works fine but second command gives the following error: syntax error at -e line 1, near "{ =~" syntax error at -e line 1, near ";}"... (2 Replies)
Discussion started by: jingi1234
2 Replies

10. AIX

Trouble formatting egrep command with AWK

Hi, I'm new to scripting and AIX. I'm running the following: lspv | awk '{ print "lspv",$1" | egrep 'PP\|PHYSICAL'; lspv -l",$1 }' Which creates this command: lspv hdisk0 | egrep PP|PHYSICAL; lspv -l hdisk0 lspv hdisk1 | egrep PP|PHYSICAL; lspv -l hdisk1 Troube is, I need the... (2 Replies)
Discussion started by: cruiser
2 Replies
Login or Register to Ask a Question