problem using CAT command in PERL


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem using CAT command in PERL
# 1  
Old 06-28-2010
Java 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.

Code:
cat FILE1.txt |cut -d "|" -f1 >INPUT1.txt

cat FILE2.txt|wc -l *9111*|>INPUT2.txt

paste INPUT1,INPUT2 >OUTPUT.txt



Thanks in advance

Regards
Adaleru

Last edited by pludi; 06-28-2010 at 02:15 AM..
# 2  
Old 06-28-2010
make the script executable.
Or use backticks.
# 3  
Old 06-28-2010
Quote:
Originally Posted by sandy1028
make the script executable.
Or use backticks.
Hi Nandy,

Thanks for your reply.

However its working fine in unix box, if i try to invoke this command in to perl its not working.
# 4  
Old 06-28-2010
What error do you get? And why invoke the cat command at all if Perl is perfectly capable of text processing (hint: it was designed for this)?

Aside from that, your second command doesn't really make sense, as wc either reads from files or from stdin.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with cat

Hey all this is probably something simple but not sure why I am getting this error. Any help is appreciated. Expected output: $ ./ex_01.ksh word1 word2 word3 word4 arguments: word1 word2 word3 word4 Number of arguments: 4 what I am getting: ./ex_01.ksh word1 word2 word3 word4 cat:... (3 Replies)
Discussion started by: linuxn00b
3 Replies

2. Shell Programming and Scripting

perl and file and cat

Hi All i need a little script that can open a file , read it and then spit out some information from it from the shell i would do cat /var/log/Xorg.0.log | grep pixel | sed 's/: 330.*//' | how can i do this nicley in perl thanks Adam (3 Replies)
Discussion started by: ab52
3 Replies

3. Shell Programming and Scripting

Problem with cat

I am trying to use the following code: cat *.txt > OutPutFile.txt Using files with a expression in one single line that always end with " ; " something like this: Block1.txt Block2.txt Block3.txt The expected result should be something like this: OutPutFile.txt: My code works OK in this... (4 Replies)
Discussion started by: Xterra
4 Replies

4. Shell Programming and Scripting

Perl tr command problem

#!/usr/bin/perl #use strict; #use warnings; my $data = 'node: id=c1, class=nb, cx=100, cy=100, r=10'; #in the above string stored in $data i want to replace = with =" and ',' with "\t so i used the tr operator as follows $data =~tr/=/="/s; print "$data"; But this is not... (2 Replies)
Discussion started by: rsanjay
2 Replies

5. Shell Programming and Scripting

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? cat input.txt|egrep -v ‘^#'|\ perl -ane ‘if (@F>3){$_=~/(chr.+):(\d+)\ s()/;print $1,”\t”,$2,”\t”,($2+35),”\n”}'\ > output.bed ... (1 Reply)
Discussion started by: repinementer
1 Replies

6. UNIX for Dummies Questions & Answers

Help me with a little problem with command cat

Hi I am having a little trouble understanding how to use this cat command. My question is the following: write a command to create a file called catFiles that contains three copies of the file catFile. If you can help me to understand how to create this, I would be very greatful. Thanks... (2 Replies)
Discussion started by: rushhour
2 Replies

7. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

8. 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

9. Shell Programming and Scripting

cat problem

Hello again; I have a file in this format ./this is/first/1 ./this is/second/2 ./this is/third/3 and i am using this file in a for loop with cat command like this for i in `cat directory.txt` do .......... done Bu there is a problem because my directory is "this is" but... (7 Replies)
Discussion started by: redbeard_06
7 Replies

10. UNIX for Advanced & Expert Users

Problem with cat

On Solaris 5.8 in ksh, I have a sample.txt with contents A 105 305 B 205 405 C 100 198 ....................... when I do a cat sample.txt the O/P is exactly as above but when I do a echo `cat sample.txt` the O/P changes to A 105 305 B 205 405 C 100 198........... Everything is... (3 Replies)
Discussion started by: macrulez
3 Replies
Login or Register to Ask a Question