03-06-2009
I guess if you had to write the same code over and over many many times it is easier, but taking the time to write the code in perl (assuming one knows how) might take all of one minute. To each his own though. TIMTO(bad)WTDI.
Good point about using system() instead of tiks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I apologize if I have already posted this query. I scanned back quite a few pages but could not find such a query.
If my perl code contains "exit(33)" how can I get that value in bash for use in a "if" statement.
Thanks,
Siegfried (5 Replies)
Discussion started by: siegfried
5 Replies
2. Shell Programming and Scripting
hi All,
Have a doubt in ksh..Am not familiar with arrays but i have tried out a script..
plzzzzz correct me with the script
My i/p File is:
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(Host = 192.168.2.2)
(Port = 1525)
)
)
(CONNECT_DATA = (SID = TESTDB1)
)
)
... (7 Replies)
Discussion started by: aajan
7 Replies
3. Shell Programming and Scripting
Hi,
I am interesting in writing the following bash codes into perl
My script is simple take field 2 in /etc/passwd and put into an array
#!/bin/bash
PASSWD_FILE=/etc/passwd
A=(`awk -F: ' { print $2 }' $PASSWD_FILE `)
Can someone give me equivalent codes in perl ? (1 Reply)
Discussion started by: phamp008
1 Replies
4. Shell Programming and Scripting
I am trying to break a large file into smaller ones, with the break defined by the character "*".
The following is the code I have so far which breaks the input file on every line instead of at the "*" character.
Input file:
1
2
3
4
*5
6
7
8
9
Code:
#!/usr/bin/perl... (2 Replies)
Discussion started by: cold_Que
2 Replies
5. Shell Programming and Scripting
...when the lines use both a colon and commas to separate the parts you want read as information.
The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies
6. Solaris
I get a file which has all its content in a single row.
The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file.
I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies
7. Shell Programming and Scripting
I cannot seem to get this to work..
I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application.
the file looks like this
this is a test
that is a test
balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies
8. UNIX for Dummies Questions & Answers
So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies
9. Shell Programming and Scripting
Hello everyone!
I'm trying to make the below file1 look like file2, can anyone help?
Basically I just hit backspace on every line that starts with a number.
Thanks!
file1:
THIS#IS-IT1
4
THIS#IS-IT2
3
THIS#IS-IT3
2
THIS#IS-IT4
1
Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies
10. Shell Programming and Scripting
This is actually a KSH under Unix System Services (Z/OS), but hoping I can get a standard AIX/KSH solution to work...
I have a very large, single line file in Windows, that we download via FTP, with the "SITE WRAP" option, into a Z/OS file with an LRECL of 200. This essentially breaks the single... (4 Replies)
Discussion started by: bubbawuzhere
4 Replies
ojo(3pm) User Contributed Perl Documentation ojo(3pm)
NAME
ojo - Fun Oneliners with Mojo!
SYNOPSIS
$ perl -Mojo -E 'say g("mojolicio.us")->dom->at("title")->text'
DESCRIPTION
A collection of automatically exported functions for fun Perl oneliners. Ten redirects will be followed by default, you can change this
behavior with the "MOJO_MAX_REDIRECTS" environment variable.
$ MOJO_MAX_REDIRECTS=0 perl -Mojo -E 'say g("mojolicio.us")->code'
Proxy detection is enabled by default, but you can disable it with the "MOJO_PROXY" environment variable.
$ MOJO_PROXY=0 perl -Mojo -E 'say g("mojolicio.us")->body'
FUNCTIONS
ojo implements the following functions.
"a"
my $app = a('/' => sub { shift->render(json => {hello => 'world'}) });
Create a route with "any" in Mojolicious::Lite and return the current Mojolicious::Lite object. See also the Mojolicious::Lite tutorial for
more argument variations.
$ perl -Mojo -E 'a("/" => {text => "Hello Mojo!"})->start' daemon
"b"
my $stream = b('lalala');
Turn string into a Mojo::ByteStream object.
$ perl -Mojo -E 'b(g("mojolicio.us")->body)->html_unescape->say'
"c"
my $collection = c(1, 2, 3);
Turn list into a Mojo::Collection object.
"d"
my $res = d('mojolicio.us');
my $res = d('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "DELETE" request with "delete" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"f"
my $res = f('http://kraih.com' => {a => 'b'});
my $res = f('kraih.com' => 'UTF-8' => {a => 'b'} => {DNT => 1});
Perform "POST" form request with "post_form" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"g"
my $res = g('mojolicio.us');
my $res = g('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "GET" request with "get" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"h"
my $res = h('mojolicio.us');
my $res = h('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "HEAD" request with "head" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"o"
my $res = o('mojolicio.us');
my $res = o('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "OPTIONS" request with "options" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"p"
my $res = p('mojolicio.us');
my $res = p('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "POST" request with "post" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"t"
my $res = t('mojolicio.us');
my $res = t('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "PATCH" request with "patch" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"u"
my $res = u('mojolicio.us');
my $res = u('http://mojolicio.us' => {DNT => 1} => 'Hi!');
Perform "PUT" request with "put" in Mojo::UserAgent and return resulting Mojo::Message::Response object.
"x"
my $dom = x('<div>Hello!</div>');
Turn HTML5/XML input into Mojo::DOM object.
$ perl -Mojo -E 'say x("<div>Hello!</div>")->at("div")->text'
SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
perl v5.14.2 2012-09-05 ojo(3pm)