Is there any thing like this perl command is csh?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is there any thing like this perl command is csh?
# 1  
Old 05-10-2006
Is there any thing like this perl command is csh?

I mean this :
perl -pi -e 's/OS/blah/g' *.c*

The Great thing in such thing i dont need to rename orig then rename back when i do it with
sed for instance inside csh shell , is there any way to avoid this with sed/awk/what ever?


Thanks
# 2  
Old 05-10-2006
Quote:
Originally Posted by umen
I mean this :
perl -pi -e 's/OS/blah/g' *.c*

The Great thing in such thing i dont need to rename orig then rename back when i do it with
sed for instance inside csh shell , is there any way to avoid this with sed/awk/what ever?


Thanks
Code:
#!/bin/ksh

for file in *.c*
do
   (echo '1,$s/OS/blah/g'; echo 'wq') | ex -s "${file}"
done

# 3  
Old 05-11-2006
can it be done with csh ?
when i try to run it as single line in csh on one file :
( echo 'test.txt ,$s/foo/blah/g' ; echo 'wq' ) | ex -s "test.txt"
im geting : test: Not an editor command
what im doing wrong here?
# 4  
Old 05-11-2006
Quote:
Originally Posted by umen
can it be done with csh ?
when i try to run it as single line in csh on one file :
( echo 'test.txt ,$s/foo/blah/g' ; echo 'wq' ) | ex -s "test.txt"
im geting : test: Not an editor command
what im doing wrong here?
I don't believe that's what I've posted!
btw, csh

Last edited by vgersh99; 05-11-2006 at 11:50 AM..
# 5  
Old 05-11-2006
no i just tryed to excute it on single file

but then i notic im using tcsh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

If command in csh

hi everyone what is difference between "if ( -e Arch )" and "if ( -e ./Arch )" in csh shell? Many Thanks samad (1 Reply)
Discussion started by: abdossamad2003
1 Replies

2. Shell Programming and Scripting

Perl Csh - setenv ENV change environment variable

I have 3 programs, 1 in perl, 2 in csh: call them perl1, csh1 and run.ol I need perl1 to set csh1 variable NOLOG_qsub = "" I need perl1 to run, run.ol run.ol takes the executable and input and outputs to output run.ol#!/bin/csh -f # run.ol executable input output perl1 should... (1 Reply)
Discussion started by: austinj
1 Replies

3. Shell Programming and Scripting

extract whole thing in word, leaving behind last word. - perl

Hi, i've a string /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12 i need to get string, like /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Discussion started by: asak
4 Replies

4. Shell Programming and Scripting

pass parameters from perl to csh scripts

I use csh a lot but I don't really write csh scripts. Now I have a need to implement a security check (written in perl; verify an user input security code) into a csh script. Here is the senario: #csh 1. call the perl script 2. if the perl script returns 'true', pass on; if the perl... (1 Reply)
Discussion started by: Julian16
1 Replies

5. Shell Programming and Scripting

Convert from Csh to Perl

Hi , I am trying to convert the below code embedded in a csh script to Perl. Can any expert give me some advice on this ? sed -n ''"$start_line"',$ p' $tester_dir/nfiles_extracted.txt|cut -c1-4,6-|/bin/perl $test_summary/compare_for_all _Duts.pl|sort > $tester_dir/nfiles_extracted1.txt (0 Replies)
Discussion started by: Raynon
0 Replies

6. Shell Programming and Scripting

How to do a formatted substittion in perl with a csh variable?

Hmm quite difficult for me to express my problem in one sentence.Introduction {i am a newbee to csh perl, awk and stuff, and by surfing these forums i managed to build quite a big code using all three of them in a script. Have to admitt, it was not a good idea, and its the perfect example of how... (3 Replies)
Discussion started by: Radamez
3 Replies

7. UNIX for Dummies Questions & Answers

Perl search and replace not working in csh script

I am using perl to perform a search and replace. It works at the command line, but not in the csh shell script perl -pi -e 's@/Pattern@@g' $path/$file I used the @ as my delimiter because the pattern contains "/" (3 Replies)
Discussion started by: NobluesFDT
3 Replies

8. Shell Programming and Scripting

Pass csh variable to Perl

Hi All, I am trying to put the csh variable into a perl. In the below case, i am trying to put the csh variable "var" into my perl code. I tried to use '"$var"' but i don;t think it works. Can anybody help me pls? #!/bin/csh set var = `echo "xxx"` perl myperlcode.pl file ... (9 Replies)
Discussion started by: Raynon
9 Replies

9. Shell Programming and Scripting

How do I get the same results in Perl as in csh

In csh I can do this echo `ps -ef | grep root | awk '{print $2}'` how would I get the same results using perl. Thanks (6 Replies)
Discussion started by: bdsffl
6 Replies

10. Shell Programming and Scripting

csh -f and the at command

Hi everyone. I am new to the forums and new to Unix, so please pardon my beginner "status". In my company, we have a few C shell scripts, which we call BAT files (!). They all start with the usual "#/bin/csh" line to get it to run the .cshrc script which preloads the session with a lot of... (1 Reply)
Discussion started by: SpanishPassion
1 Replies
Login or Register to Ask a Question