9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I have a tab delimited text file like this one. I need to do a partial match of a particular cell and then replace matches with an empty cell. So here is a sample:
Smith FordMustang ChevroletCamaro
Miller FordFiesta
Jones KiaSorrento
Davis ChevroletCamaro
Johnson ToyotaHighlander
I... (4 Replies)
Discussion started by: mikey11415
4 Replies
2. Shell Programming and Scripting
I posted the incorrect files yesterday and apologize. I also modified the awk script but with no luck. There are two text files in the zip (name.txt and output.txt). I am trying to match $2 in name.txt with $1 in output.txt and if they match then $1 of name.txt is copied to $7 of output.txt. ... (7 Replies)
Discussion started by: cmccabe
7 Replies
3. Shell Programming and Scripting
I am connecting to another server through sftp. I am running one batch script to pull file from another server. sometimes i am receiving partial files. I am using below commands in batch script.
ls -ltr new.txt
mget new.txt
bye
The file is of 1 MB only.In most of the cases , i received... (6 Replies)
Discussion started by: srinath01
6 Replies
4. UNIX for Dummies Questions & Answers
Hi I have a question and hope I can get answer here. Thank you in advance.
I have two files:
file1:
aa X
bb Y
cc Z
file2:
cc A
bb B
dd C
aa D
bb E
If the 1st column match in both file1 and file2, the 2nd column in file2 will be replaced by the 2nd column in file1. If there is no... (2 Replies)
Discussion started by: yuejian
2 Replies
5. Shell Programming and Scripting
I have this in log file /var/log/maillog
XXX YYY ZZZ :15214 I=:25 AAA BBB CCC
I need awk/sed operation on this, so that it retrieves only the first IP.
cat /var/log/maillog | sed_operation
55.66.77.88 (2 Replies)
Discussion started by: anil510
2 Replies
6. Shell Programming and Scripting
I have a list of strings in file:
10 10 AAA
120 13 BBBBB
23 11 CCCCC
11 32 DDDDDD
I want to replace first column of the text such as: 10, 129, 23, 11 with 11, 22, 33, 44.
I can do line by line, but just not sure how to replace partial string without... (1 Reply)
Discussion started by: ford99
1 Replies
7. Shell Programming and Scripting
Hello, this is probably a simple request but I've been toying with it for a while.
I have a large list of devices and commands that were run with a script, now I have lines such as:
a-router-hostname-C#show ver
I want to print everything up to (and excluding) the # and everything after it... (3 Replies)
Discussion started by: ippy98
3 Replies
8. Shell Programming and Scripting
Hi there!
New user to UNIX scripting. Had a question I was stuck on.
I've been trying to make a script(for a larger project) that would search a file(lets say playerlist).
the file is already formatted into columns so it may look like
First name(1-10) Last Name(11-20) address (21-30)
... (23 Replies)
Discussion started by: Sagramor
23 Replies
9. Shell Programming and Scripting
Hi,
Need to delete line prior to (INSERT/UPDATE/DELETE). In case ' available, then keep that. Pls refet below details.
Input
======================
l_s := ' INSERT INTO TEST'
l_P PD := ' UPDATE INTO TEST'
l_D := ' DELETE INTO TEST'
This is test
Output... (4 Replies)
Discussion started by: saurabhbaisakhi
4 Replies
Parser(3pm) User Contributed Perl Documentation Parser(3pm)
NAME
HTTP::Parser - parse HTTP/1.1 request into HTTP::Request/Response object
SYNOPSIS
my $parser = HTTP::Parser->new();
...
my $status = $parser->add($text);
if(0 == $status) {
print "request: ".$parser->request()->as_string(); # HTTP::Request
} elsif(-3 == $status) {
print "no content length header!
";
} elsif(-2 == $status) {
print "need a line of data
";
} elsif(-1 == $status) {
print "need more data
";
} else { # $status > 0
print "need $status byte(s)
";
}
DESCRIPTION
This is an HTTP request parser. It takes chunks of text as received and returns a 'hint' as to what is required, or returns the
HTTP::Request when a complete request has been read. HTTP/1.1 chunking is supported. It dies if it finds an error.
new ( named params... )
Create a new HTTP::Parser object. Takes named parameters, e.g.:
my $parser = HTTP::Parser->new(request => 1);
request
Allows or denies parsing an HTTP request and returning an "HTTP::Request" object.
response
Allows or denies parsing an HTTP response and returning an "HTTP::Response" object.
If you pass neither "request" nor "response", only requests are parsed (for backwards compatibility); if you pass either, the other
defaults to false (disallowing both requests and responses is a fatal error).
add ( string )
Parse request. Returns:
0 if finished (call "object" to get an HTTP::Request or Response object)
-1 if not finished but not sure how many bytes remain
-2 if waiting for a line (like 0 with a hint)
-3 if there was no content-length header, so we can't tell whether we are waiting for more data or not.
If you are reading from a TCP stream, you can keep adding data until the connection closes gracefully (the HTTP RFC allows this).
If you are reading from a file, you should keep adding until you have all the data.
Once you have added all data, you may call "object". if you are not sure whether you have all the data, the HTTP::Response object
might be incomplete.
count if waiting for that many bytes
Dies on error.
This method of parsing makes it easier to parse a request from an event-based system, on the other hand, it's quite alright to pass in the
whole request. Ideally, the first chunk passed in is the header (up to the double newline), then whatever byte counts are requested.
When a request object is returned, the X-HTTP-Version header has the HTTP version, the uri() method will always return a URI object, not a
string.
Note that a nonzero return is just a hint, and any amount of data can be passed in to a subsequent add() call.
data
Returns current data not parsed. Mainly useful after a request has been parsed. The data is not removed from the object's buffer, and
will be seen before the data next passed to add().
extra
Returns the count of extra bytes (length of data()) after a request.
object
Returns the object request. Only useful after the parse has completed.
AUTHOR
David Robins <dbrobins@davidrobins.net> Fixes for 0.05 by David Cannings <david@edeca.net>
SEE ALSO
HTTP::Request, HTTP::Response.
perl v5.10.1 2011-03-06 Parser(3pm)