Sponsored Content
Full Discussion: UNIX Text Search Scripting
Top Forums Shell Programming and Scripting UNIX Text Search Scripting Post 302364766 by ghostdog74 on Friday 23rd of October 2009 07:41:24 PM
Old 10-23-2009
both sed /awk suffers from greediness. another approach
Code:
awk 'BEGIN{FS="</field>"}
{
   for (i=1;i<NF;i++){
    gsub(/.*fieldname=/,"",$i)
    print $i
   }
}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

2. UNIX for Dummies Questions & Answers

Unix search a string in the text file

File name : Sample.txt Actually i would like to read <schema>Oracle<schema> string from input file and return only once database as my output. Please advise me. Moved to appropriate forum. (1 Reply)
Discussion started by: balajikalai
1 Replies

3. Shell Programming and Scripting

generate tabular output from an input text file in unix shell scripting

Hi, I have the output (as below) which i want it to be in a table. For e.g. space utilization in PSE on path /logs is 0% space utilization in PSE on path /logs/tuxedo/tuxlsp is 16% space utilization in PSE on path /ldvarlsp/lsp/log is 37% space utilization in PSE on path /home is 6%... (7 Replies)
Discussion started by: pkbond
7 Replies

4. Shell Programming and Scripting

How to search and append words in the same file using unix scripting file operations

Hi , I have a file myhost.txt which contains below, 127.0.0.1 localhost 1.17.1.5 atrpx958 11.17.10.11 atrpx958zone nsybhost I need to append words only after "atrpx958" like 'myhost' and 'libhost' and not after atrpx958zone. How to search the word atrpx958(which is hostname) only,... (5 Replies)
Discussion started by: gsreeni
5 Replies

5. Shell Programming and Scripting

Read in search strings from text file, search for string in second text file and output to CSV

Hi guys, I have a text file named file1.txt that is formatted like this: 001 , ID , 20000 002 , Name , Brandon 003 , Phone_Number , 616-234-1999 004 , SSNumber , 234-23-234 005 , Model , Toyota 007 , Engine ,V8 008 , GPS , OFF and I have file2.txt formatted like this: ... (2 Replies)
Discussion started by: An0mander
2 Replies

6. UNIX for Dummies Questions & Answers

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display... (1 Reply)
Discussion started by: 12ic11
1 Replies

7. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi everyone, I am new to Unix and need help writing a script that can ask user for an input, then search that input within a file I know will have to use the read and grep commands, anyone can give me somewhere to start would help Task: Write a script to display which volume pool a given... (1 Reply)
Discussion started by: 12ic11
1 Replies

8. Shell Programming and Scripting

UNIX Scripting help to input string and search a file to find

Hi Don, this is not homework question. I work for a Credit card company and my development goal this year is to learn Unix. I would love if others can help me get started, thanks. Hi everyone I am new to Unix and need help writing a script that can ask user for an input, then search that input... (2 Replies)
Discussion started by: 12ic11
2 Replies

9. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

10. UNIX for Beginners Questions & Answers

How to search a text in file and retrieve required lines following it with UNIX command?

I have requirement to search for a text in the file and retrieve required lines that is user defined with unix command. Eg: Find the text UNIX in the below file and need to return Test 8 & Test 9 Test 1 Test 2 Test 3 Test 4 UNIX Test 5 Test 6 Test 7 Test 8 Test 9 Result can... (8 Replies)
Discussion started by: Arunkumarsak4
8 Replies
Dumper(3)						User Contributed Perl Documentation						 Dumper(3)

NAME
XML::Dumper - Perl module for dumping Perl objects from/to XML SYNOPSIS
# Convert Perl code to XML use XML::Dumper; my $dump = new XML::Dumper; $data = [ { first => 'Jonathan', last => 'Eisenzopf', email => 'eisen@pobox.com' }, { first => 'Larry', last => 'Wall', email => 'larry@wall.org' } ]; $xml = $dump->pl2xml($perl); # Convert XML to Perl code use XML::Dumper; my $dump = new XML::Dumper; # some XML my $xml = <<XML; <perldata> <scalar>foo</scalar> </perldata> XML # load Perl data structure from dumped XML $data = $dump->xml2pl($Tree); DESCRIPTION
XML::Dumper dumps Perl data to a structured XML format. XML::Dumper can also read XML data that was previously dumped by the module and convert it back to Perl. This is done via the following 2 methods: XML::Dumper::pl2xml XML::Dumper::xml2pl AUTHOR
Jonathan Eisenzopf <eisen@pobox.com> CREDITS
Chris Thorman <ct@ignitiondesign.com> L.M.Orchard <deus_x@pobox.com> DeWitt Clinton <dewitt@eziba.com> SEE ALSO
perl(1), XML::Parser(3). perl v5.8.0 1999-06-20 Dumper(3)
All times are GMT -4. The time now is 03:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy