Still thin Perl is long winded and cumbersome to use ...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Still thin Perl is long winded and cumbersome to use ...
# 1  
Old 05-30-2013
Still thin Perl is long winded and cumbersome to use ...

Code:
grep " $1 " completelist 
if [ $? = 1 ]
 then
echo "$1 not found."
fi

Is there a Perl solution that just as short sweet and fast ?
# 2  
Old 05-30-2013
I'm a fan of Perl but grep is better at being grep Smilie
Code:
grep $1 comletelist || echo "Not here"

EDIT: Though I sometimes use Perl over egrep because I know what regex library I'm talking to regardless of the host OS

Last edited by Skrynesaver; 05-30-2013 at 01:23 PM.. Reason: To ad egrep caveat
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl :: Getopt::Long in the program

While going through some of the perl script... I had found the below line.. use Getopt::Long; my $GetOptionsReturnCode = GetOptions ( '<>' => sub { push(@unknownArg, @_); }, 'h|help' => sub { &helpMessage(); exit 0; }, ); Could anyone please explain the above one ... (1 Reply)
Discussion started by: scriptscript
1 Replies

2. Programming

Perl Getopt::Long

Hi All I am using Getopt::Long in perl and i am trying to have it so if i dont supply a switch after the progname is will do a defult option i have the following GetOptions($OPT, 'debug|d', 'mail|m', ) or info(); i want it run the debug if it is not given a switch ... (1 Reply)
Discussion started by: ab52
1 Replies

3. Shell Programming and Scripting

Inserting into long delimited string using perl.

Hi, I have a very long pipe delimited string. The length of the string could vary. For example: START|one|two|three|four|five|six|seven START|one|two|three|four|five|six|seven|eight|nine START|one|two|three|four I want to replace in the third occurence of string with another... (9 Replies)
Discussion started by: som.nitk
9 Replies

4. Shell Programming and Scripting

How long ago since time - Using perl

echo "1337124526" | perl -pe 's/(\d+)/easttime($1)/e' the above gives a date and time. how can i subtract the date and time given by this command, from the current present date? can this be a one liner or as close to a one-liner as possible? (1 Reply)
Discussion started by: SkySmart
1 Replies

5. Shell Programming and Scripting

using jdbc:thin in bash

Hi I want to include in my script a test for DB connection with jdbc:thin connection string(not using tnsnames.ora) For example:... (3 Replies)
Discussion started by: gdan2000
3 Replies

6. Shell Programming and Scripting

How to make a long print string to shotcut form in perl?

print "1.readfromfile\n2.add_ex1(4,5)\n3.add_ex2(11,5)\n4.add_ex3(9,3)\n5.add_ex4(91,4)\n"; How to do it in this form: print "1.readfromfile\n 2.add_ex1(4,5)\n 3.add_ex2(11,5)\n 4.add_ex3(9,3)\n 5.add_ex4(91,4)\n"; (3 Replies)
Discussion started by: cola
3 Replies

7. Shell Programming and Scripting

Perl Getopt::Long question - stopping multiple args

Hi there, I have an example basic script (below) and ive been trying to figure out how to stop multiple arguments to my options occuring. for example using the example script below I can issue two arguments for, say the --surname option and it will not barf at me (although thats what i want it to... (11 Replies)
Discussion started by: rethink
11 Replies

8. Shell Programming and Scripting

Perl - How do you break the long line of codes into 2?

I'm trying to make this long line of codes in Perl looks nice by dividing it into 2 lines... Before: `echo "blahblahblahblahblahblahblahblahblahblahblah" > ~/lalala/lalala/lalala/lalala/lalala/abc`; After: `echo "blahblahblahblahblahblahblahblahblahblahblah" > ... (5 Replies)
Discussion started by: teiji
5 Replies

9. Linux

BOOTP on HP Thin clients

Please m new around here! Can anyone take me thru implementing bootp on my thin clients via my central server? Preciate ur assistance. Thanks folks! (2 Replies)
Discussion started by: chuk_uka
2 Replies
Login or Register to Ask a Question