Hi All,
I have files:
1. abc.sql
'This is a sample file for testing'
This does not have quotations
this also does not have quotations.
and this 'has quotations'.
here I need to list the hard coded strings 'This is a sample file for testing' and
'has quotations'.
So i have... (13 Replies)
Hi,
I have huge file,
head -1 filneame gives,
I just want to remove "##colsep##" from the file, and also want to count the no. of fileds present, as in
Output shld be in newfile as TRADE_KEY,TRADE_DATE
and total no. of fileds separated by these comma's
... (7 Replies)
I need to print the second field of a file, taking spaces, tab and = as field separators.
; for 16-bit app support
MAPI=1
CMC=1
CMCDLLNAME32=mapi32.dll
CMCDLLNAME=mapi.dll
MAPIX=1
MAPIXVER=1.0.0.1
OLEMessaging=1
asf=MPEGVideo
asx=MPEGVideo
ivf=MPEGVideo
m3u=MPEGVideo (2 Replies)
Hello!
I wroted a little script that should check for new updates on a server and get them if any. The problem is, every time I run it with sh, I'm getting an "script: 20: Syntax error: Unterminated quoted string" error!
The problem is, there isn't any "unterminated quoted string" in my script:... (2 Replies)
Hi, Gurus,
I have a file like
1 234, 345, 456
2 345, 456, 345
I want to use awk with multipe separator ( one is comma, another is space)print out $1, $3 which should be:
1, 345
2, 456
but I don't know how to put space as separator with another separator.
Thanks in advance (7 Replies)
Hi,
I have a script output.sh which produces the following output (as an example):
"abc def" "ghi jkl"
This output should be handled from script input.sh as input and the quotes should be treated as variable delimiters but not as regular characters.
input.sh (processing positional... (2 Replies)
Hi,
I used to count number of fields using following command head -1 <filename> | awk -F"," '{print NF}'
Now the scenario is the delimiter(comma) occurs inside one of the data field. How to ignore the comma inside data and consider only delimiter and count number of fields. The fields are... (1 Reply)
I have files such as
n02-z30-dsr65-terr0.25-dc0.008-16x12drw-run1.cmd
I am wondering if it is possible to define two field separators "-" and "."
for these strings so that $7 is run1. (5 Replies)
I want to parse the lines and want to extract the double quoted numbers as:
"SQL3149N "72" rows were processed from the input file. "0" rows were
successfully inserted into the table. "0" rows were rejected."
and want the output in 3 variables like
a=72
b=0
c=0
thanks in advance
... (3 Replies)
vi uses dash and space as word separators. is there any way to exclude dash from word separators ?
This is required to work with the symbols generated by ctags exe. when symbol contain a "-" ,vi tags fails to locate that even though symbol is generated properly.
For example Symbol -... (3 Replies)
Discussion started by: cabhi
3 Replies
LEARN ABOUT MOJAVE
http::headers::util5.18
HTTP::Headers::Util(3) User Contributed Perl Documentation HTTP::Headers::Util(3)NAME
HTTP::Headers::Util - Header value parsing utility functions
SYNOPSIS
use HTTP::Headers::Util qw(split_header_words);
@values = split_header_words($h->header("Content-Type"));
DESCRIPTION
This module provides a few functions that helps parsing and construction of valid HTTP header values. None of the functions are exported
by default.
The following functions are available:
split_header_words( @header_values )
This function will parse the header values given as argument into a list of anonymous arrays containing key/value pairs. The function
knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they
were separated by ";".
If the @header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by
comma ",".
This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but
we relax the requirement for tokens).
headers = #header
header = (token | parameter) *( [";"] (token | parameter))
token = 1*<any CHAR except CTLs or separators>
separators = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "" | <">
| "/" | "[" | "]" | "?" | "="
| "{" | "}" | SP | HT
quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
qdtext = <any TEXT except <">>
quoted-pair = "" CHAR
parameter = attribute "=" value
attribute = token
value = token | quoted-string
Each header is represented by an anonymous array of key/value pairs. The keys will be all be forced to lower case. The value for a
simple token (not part of a parameter) is "undef". Syntactically incorrect headers will not necessarily be parsed as you would want.
This is easier to describe with some examples:
split_header_words('foo="bar"; port="80,81"; DISCARD, BAR=baz');
split_header_words('text/html; charset="iso-8859-1"');
split_header_words('Basic realm="\"foo\\bar\""');
will return
[foo=>'bar', port=>'80,81', discard=> undef], [bar=>'baz' ]
['text/html' => undef, charset => 'iso-8859-1']
[basic => undef, realm => ""foo\bar""]
If you don't want the function to convert tokens and attribute keys to lower case you can call it as "_split_header_words" instead
(with a leading underscore).
join_header_words( @arrays )
This will do the opposite of the conversion done by split_header_words(). It takes a list of anonymous arrays as arguments (or a list
of key/value pairs) and produces a single header value. Attribute values are quoted if needed.
Example:
join_header_words(["text/plain" => undef, charset => "iso-8859/1"]);
join_header_words("text/plain" => undef, charset => "iso-8859/1");
will both return the string:
text/plain; charset="iso-8859/1"
COPYRIGHT
Copyright 1997-1998, Gisle Aas
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.18.2 2012-02-16 HTTP::Headers::Util(3)