03-16-2008
awk- report generation from input file
Thanks Klashxx
its Wonderful, it works.
I was trying to undersand what does FS="( )|(,)" do?
Could you please give more info on this, however without the above also the output is same
awk '/^Name/{n=$NF}/^Address/{a=$2}/^City/{print n,a,$NF}' inpfile
lastname1 111, Hilversum
lastname2 222, Bussum
lastname3 333, Amsterdam
now the request is different:
the input file is :
Person:
Name: Firstname1 lastname1
Address: 111, Street "Narder straat"
City : Hilversum
Person:
Name : Fistname2 lastname2
Address: 222, Street "Zoud straat"
City: Bussum
Person:
Name : Firstname2 lastname3
Address: 333, Street "Station straat"
City: Amsterdam
I need the outout file as below:
lastname1 111 "Narder straat" Hilversum
lastname2 222 "Zoud straat" Bussum
lastname3 333 "Station straat" Amsterdam
Thanks again
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am beginner in shell programming.In a shell script i found a call to a script
'runrep25m',which i think is to generate oracle reports?Could anyone help me by providing some details about its usage
With Thanks & Regards
Dileep (7 Replies)
Discussion started by: DILEEP410
7 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I got a requirement in writing a sheel script in unix, please help me out
the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2.
I would like to compare all the... (2 Replies)
Discussion started by: gmahesh2k
2 Replies
3. Shell Programming and Scripting
Hello,
I got a requirement in writing a KSH script in unix, please help me out
the requirement is there are two folders Folder1 and Folder2 and there are same files in the different folders. like file1,file2 in folder1 and file1 and file2 in folder2.
I would like to compare all the similar... (3 Replies)
Discussion started by: gmahesh2k
3 Replies
4. Shell Programming and Scripting
Hey guys,
I have this file generated by me... i want to create some HTML output from it.
The problem is that i am really confused about how do I go about reading the file.
The file is in the following format:
TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies
5. Shell Programming and Scripting
All,
I am pretty new to Unix Environment. I am not sure if my requirement can be accomplished in Unix. I did try searching this forum and others but could not get an answer. Requirement is explained below:
I have a set of files in a folder.
file1_unload
file2_unload
file3_unload... (7 Replies)
Discussion started by: bharath.gct
7 Replies
6. Shell Programming and Scripting
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies
7. Shell Programming and Scripting
hi all
i need to generate a report file that contains the following details of files present in a directory.
1. File name
2.Complete path for each files and directory
3.File size
4.Days older
example i have a directory testing that contains sub-directories and some files.
i need to make a... (5 Replies)
Discussion started by: yashwantkumar
5 Replies
8. Shell Programming and Scripting
Hi
I have one thing I need advice on, and I don't know where to start so I have no sample code.
I want the user to provide input like: 1-3,6,7,9-11
When the input is like this, I want a string to be generated including all the numbers. In the example above, the string would look like:
1... (13 Replies)
Discussion started by: Tobbev
13 Replies
9. Shell Programming and Scripting
Hi,
I have a perl script to read the log file and create a report from it. I have the script file and log file in a different directories. Now i have pipe the log file data to the perl script to create the report (HMTL file). I am using the below command this isn't working
tail -f... (4 Replies)
Discussion started by: vel4ever
4 Replies
10. UNIX for Beginners Questions & Answers
Hi all
I have a unix script that generates a report with the following information:
uptime, mounted file systems, disk usage (> 90% --> critical, <75%-90%> --> warning, < 75% healthy), Mem usage, CPU usage and load average.
But I would like to create one single report containing all this... (5 Replies)
Discussion started by: fretagi
5 Replies
LEARN ABOUT DEBIAN
xml::atom::entry
XML::Atom::Entry(3pm) User Contributed Perl Documentation XML::Atom::Entry(3pm)
NAME
XML::Atom::Entry - Atom entry
SYNOPSIS
use XML::Atom::Entry;
my $entry = XML::Atom::Entry->new;
$entry->title('My Post');
$entry->content('The content of my post.');
my $xml = $entry->as_xml;
my $dc = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/');
$entry->set($dc, 'subject', 'Food & Drink');
USAGE
XML::Atom::Entry->new([ $stream ])
Creates a new entry object, and if $stream is supplied, fills it with the data specified by $stream.
Automatically handles autodiscovery if $stream is a URI (see below).
Returns the new XML::Atom::Entry object. On failure, returns "undef".
$stream can be any one of the following:
o Reference to a scalar
This is treated as the XML body of the entry.
o Scalar
This is treated as the name of a file containing the entry XML.
o Filehandle
This is treated as an open filehandle from which the entry XML can be read.
$entry->content([ $content ])
Returns the content of the entry. If $content is given, sets the content of the entry. Automatically handles all necessary escaping.
$entry->author([ $author ])
Returns an XML::Atom::Person object representing the author of the entry, or "undef" if there is no author information present.
If $author is supplied, it should be an XML::Atom::Person object representing the author. For example:
my $author = XML::Atom::Person->new;
$author->name('Foo Bar');
$author->email('foo@bar.com');
$entry->author($author);
$entry->link
If called in scalar context, returns an XML::Atom::Link object corresponding to the first <link> tag found in the entry.
If called in list context, returns a list of XML::Atom::Link objects corresponding to all of the <link> tags found in the entry.
$entry->add_link($link)
Adds the link $link, which must be an XML::Atom::Link object, to the entry as a new <link> tag. For example:
my $link = XML::Atom::Link->new;
$link->type('text/html');
$link->rel('alternate');
$link->href('http://www.example.com/2003/12/post.html');
$entry->add_link($link);
$entry->get($ns, $element)
Given an XML::Atom::Namespace element $ns and an element name $element, retrieves the value for the element in that namespace.
This is useful for retrieving the value of elements not in the main Atom namespace, like categories. For example:
my $dc = XML::Atom::Namespace->new(dc => 'http://purl.org/dc/elements/1.1/');
my $subj = $entry->get($dc, 'subject');
$entry->getlist($ns, $element)
Just like $entry->get, but if there are multiple instances of the element $element in the namespace $ns, returns all of them. get will
return only the first.
AUTHOR & COPYRIGHT
Please see the XML::Atom manpage for author, copyright, and license information.
perl v5.12.4 2009-04-24 XML::Atom::Entry(3pm)