awk to perl convert


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk to perl convert
# 1  
Old 12-11-2007
Lightbulb awk to perl convert

Dear Collegue
Do anybody help me to convert this AWK script to Perl script

{
for (i = 2; i <= length ($0); i++) {
x = substr($0, i , 1)
if (c > 0) {
b = b x
if (x == "(") c++
if (x == ")") c--
}
if (c == 0 && substr($0, i, 3) ~ /^\(VP$/) {
if (b) print b
b = x
c++
}
}
}
END {
if (b) print b
}

Jagan
# 2  
Old 12-11-2007
Try a2p Smilie
# 3  
Old 12-11-2007
Thank you very much for this valuable information

With warm regards

Jagan
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert awk line into perl

I have an awk statement in a ksh script that looks for a certain string then looks at each line after to find another match. The match could be the next line or second down and it works well. nawk 'BEGIN {FS=RS;RS="!"} /interface loopback0/ {for(i=1;i<=NF; i++) if ($i ~ /ip... (5 Replies)
Discussion started by: numele
5 Replies

2. Shell Programming and Scripting

Convert rows into columns using awk or perl

hi friends, i am able to parse cvs diff file using bit of cut and grep commands to produce following output in text file '''cvs-diff.txt''' Package-Name = dev-freetype. Old-Version = 2.4.8 New-Version = 2.4.10 Patches-removed = freetype-2.4.8-cross-compile.patch... (2 Replies)
Discussion started by: alexzander18
2 Replies

3. Shell Programming and Scripting

perl to shell convert

#!/usr/bin/perl #************************************************************** # # PERL SCRIPT # This script restarts the Application # # ##************************************************************** $ENV{'IFS'} = ' '; #open(STDERR,">&STDOUT"); #select... (2 Replies)
Discussion started by: srikoundinya
2 Replies

4. Shell Programming and Scripting

Help with convert awk script into perl

Input file (a list of input file name with *.txt extension): campus.com_icmp_ping_alive.txt data_local_cd_httpd.txt data_local_cd.txt new_local_cd_mysql.txt new_local_cd_nagios_content.txt Desired output file: data local_cd_httpd data local_cd new local_cd_mysql new ... (9 Replies)
Discussion started by: perl_beginner
9 Replies

5. Shell Programming and Scripting

Convert awk command to Perl

Hi all; I have a Perl script that uses this awk command wrapped in a "system" call; it works exactly as I want it; however I want to keep this a Perl script and have very few if any "system" command...so the question; can someone help me code this in Perl please ... i have tried an now I am... (1 Reply)
Discussion started by: gvolpini
1 Replies

6. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

7. Shell Programming and Scripting

Convert sed to perl

Can anyone convert this from sed to perl: sed -n '/\var\/log/p' /etc/syslog.conf I think Ive looked at this to much....urgh.. Thanks Ben (5 Replies)
Discussion started by: bigben1220
5 Replies

8. Shell Programming and Scripting

Help: how to convert perl script to awk in windows2003 server environment

For the following perl script, can anyone help to convert it to awk statement in windows2003 server environment ? Code: foreach $k (sort {$a <=> $b} keys %psnum) (1 Reply)
Discussion started by: tojzz
1 Replies

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

10. Shell Programming and Scripting

***convert from perl to bash***

can any body translate the follwing script into one that works in bash? #!/usr/bin/perl # classify_books.pl my $csv_file = shift; my %categories = ( 'childrens' => 'childrens_books.txt', 'horror' => 'horror_books.txt', 'sports ' =>... (3 Replies)
Discussion started by: ferrycorsten73
3 Replies
Login or Register to Ask a Question