03-11-2014
FYI: your one liner is actually 3 lines of perl code separated by ";".
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm writing a script to automate some post-install tasks on RHEL4 servers.
I need the following code to insert an 'A' in the middle of a string, then replace the string in a file. I know I can use sed to do this, but I'd like to use perl's in place edit so I don't have to write to a temp file,... (1 Reply)
Discussion started by: Xek
1 Replies
2. Shell Programming and Scripting
Hi ,
Can anybody explain how this perl one liner works..
It is to test whether the number is prime or not
perl -le 'print "PRIME" if (1 x shift) !~ /^(11+)\1+$/' 19
Thanks in advance
Shihab (2 Replies)
Discussion started by: shihabvk
2 Replies
3. Shell Programming and Scripting
In a ~4GB file there are lines like,
13.13.4.3 Googe.com - Jan/23/2011:00:00:00 +0000 "URL Google HTTP/1.1" 45 56 208 - "http://www.gogle.com/webhp?hl=en&tab=nw#hl=en&source=hp&biw=1366&bih=667&q=hello&aq=f&aqi=&aql=&oq=&fp=c432485467934a89" ".Net; Fox" -
13.145.3.3 Goge.com -... (3 Replies)
Discussion started by: gameboy87
3 Replies
4. Shell Programming and Scripting
Thanks for giving your time and effort to answer questions and helping newbies like me understand awk.
I have a huge file, millions of lines, so perl takes quite a bit of time, I'd like to convert these perl one liners to awk.
Basically I'd like all lines with ISA sandwiched between... (9 Replies)
Discussion started by: verge
9 Replies
5. Shell Programming and Scripting
can someone help me translate the following command, from:
/usr/bin/awk "/^$TOFDAYM $TOFDAYD /,0" $LOGFILE
to something like
perl -e .....
basically, i want to use perl to do awk functions within a shell script. i want to do the above awk, using perl.
any suggestions? (9 Replies)
Discussion started by: SkySmart
9 Replies
6. Shell Programming and Scripting
hello,
I want to replace awk with a perl one liner in unix.
i use in awk REGEX and FS ( field separator) because
awk syntaxes in different unix os versions have not the same behaviour.
Awk, Nawk and GNU Awk Cheat Sheet - good coders code, great reuse
i have a file named "file" and want... (5 Replies)
Discussion started by: bora99
5 Replies
7. UNIX for Dummies Questions & Answers
Not quite a unix question but problem in a perl command. Taking a chance if someone knows about the error
cat 1
a b c d
perl -p -e 's/a/b/g' 1
b b c d
What is the problem here??
perl -p -i -e 's/a/b/g' 1
Can't remove 1: Text file busy, skipping file. (2 Replies)
Discussion started by: analyst
2 Replies
8. Shell Programming and Scripting
Hi all,
I need a Perl one liner which prints a newline into a .txt file, only where the line starts with "/mediawiki-1.19.0/". It should add the newline to the line before.
My problem is, when I try to realize this (with my little knowledge :rolleyes: ) i come to the point where the // are... (4 Replies)
Discussion started by: Mr.Smith
4 Replies
9. Shell Programming and Scripting
Greetings fellow scripters.
I find myself editing multiple files, sometimes with the same bits of information. My bash script, a changelog, and a plist file (OS X). Once I realized this, I thought why not script part of this process (and so it begins). In any case, I've solved several of the... (1 Reply)
Discussion started by: reid
1 Replies
10. Shell Programming and Scripting
Hi
I have an inherited perl script that extracts the first three octets of an IP Address using a combination of split() against a dot and then builds it all back together again, its a whole block of code to do this
I wondered if anyone had a one liner in their arsenal to extract the first... (7 Replies)
Discussion started by: hcclnoodles
7 Replies
LEARN ABOUT CENTOS
scandeps
SCANDEPS(1p) User Contributed Perl Documentation SCANDEPS(1p)
NAME
scandeps - Scan file prerequisites
SYNOPSIS
% scandeps *.pm # Print PREREQ_PM section for *.pm
% scandeps -e 'STRING' # Scan an one-liner
% scandeps -B *.pm # Include core modules
% scandeps -V *.pm # Show autoload/shared/data files
% scandeps -R *.pm # Don't recurse
% scandeps -C CACHEFILE # use CACHEFILE to cache dependencies
DESCRIPTION
scandeps is a simple-minded utility that prints out the "PREREQ_PM" section needed by modules.
If you have CPANPLUS installed, modules that are part of an earlier module's distribution with be denoted with "S"; modules without a
distribution name on CPAN are marked with "?".
Also, if the "-B" option is specified, module belongs to a perl distribution on CPAN (and thus uninstallable by "CPAN.pm" or "CPANPLUS.pm")
are marked with "C".
Finally, modules that has loadable shared object files (usually needing a compiler to install) are marked with "X"; with the "-V" flag,
those files (and all other files found) will be listed before the main output. Additionally, all module files that the scanned code depends
on but were not found (and thus not scanned recursively) are listed. These may include genuinely missing modules or false positives. That
means, modules your code does not depend on (on this particular platform) but that were picked up by the heuristic anyway.
OPTIONS
-e STRING
Scan STRING as a string containing perl code.
-c Compiles the code and inspects its %INC, in addition to static scanning.
-x Executes the code and inspects its %INC, in addition to static scanning.
-B Include core modules in the output and the recursive search list.
-R Only show dependencies found in the files listed and do not recurse.
-V Verbose mode: Output all files found during the process; show dependencies between modules and availability.
Additionally, warns of any missing dependencies. If you find missing dependencies that aren't really dependencies, you have probably
found false positives.
-C CACHEFILE
Use CACHEFILE to speed up the scanning process by caching dependencies. Creates CACHEFILE if it does not exist yet.
SEE ALSO
Module::ScanDeps, CPANPLUS::Backend, PAR
ACKNOWLEDGMENTS
Simon Cozens, for suggesting this script to be written.
AUTHORS
Audrey Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2003, 2004, 2005, 2006 by Audrey Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
perl v5.14.2 2012-02-24 SCANDEPS(1p)