Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to search two strings in a file and print the contents in between to a file Post 302544021 by jim mcnamara on Tuesday 2nd of August 2011 04:59:58 PM
Old 08-02-2011
Code:
awk '/<ObjectErrors>/ {ok=1; next}
       index($0,"</ObjectErrors>")>0  {ok=0; next}
       ok==1 {print $0} '   input.xml > outputfile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search for the contents in many file and print that file using shell script

hello have a file1 H87I Y788O T347U J23U and file2 J23U U887Y I99U T556U file3 I99O J99T F557J file4 N99I T666U R55Y file5 H87I T347U file6 H77U R556Y E44T file7 Y788O K98U H8I May be using script we can use file1 to search for all the files and have the output H87I file5... (3 Replies)
Discussion started by: cdfd123
3 Replies

2. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

3. Shell Programming and Scripting

Replace Contents between 2 strings in a file with contens of another file

Please I want to replace all the contents beween "Section" and "Ensection" in file1 with all contents in file2. Example: file1: Section "Screen" DefaultDepth 24 SubSection "Display" Depth 8 ViewPort 0 0 Modes "1024x768" "800x600" "640x480" EndSubsection SubSection "Display" Depth... (9 Replies)
Discussion started by: powelltallen
9 Replies

4. Shell Programming and Scripting

Run a program-print parameters to output file-replace op file contents with max 4th col

Hi Friends, This is the only solution to my task. So, any help is highly appreciated. I have a file cat input1.bed chr1 100 200 abc chr1 120 300 def chr1 145 226 ghi chr2 567 600 unix Now, I have another file by name input2.bed (This file is a binary file not readable by the... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

5. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

6. 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

7. UNIX for Beginners Questions & Answers

Using strings in one file as regex to search field of another file

I have a data file, file1.txt, such as the following: 1,2 "TWRTW", "TWRH/" 1,2 "JHGH", "HGJ 1,2 "JWMM", "JWMM" 1,2 "W", "W" 1,2 "LJLH", "LJLH/" 1,3 "W", "W" 1,3 "HJH", "HJJ I have another file, file2.txt, that contains... (3 Replies)
Discussion started by: jvoot
3 Replies

8. Shell Programming and Scripting

How to print contents of file when the file path is in a variable?

The file f1 contains the text "body" (shell prompt is "$"): $ cat ~/path/f1 body How to print contents of f1 when the f1 path is in a variable? Here is my failed attempt: $ f1="~/path/f1" $ echo $f1 ~/path/f1 $ cat $f1 cat: '~/path/f1': No such file or directory (2 Replies)
Discussion started by: wolfv
2 Replies

9. UNIX for Beginners Questions & Answers

sed read contents of file and print value another file

Trying to use sed to insert the contents of a file into the end of each line in another file file1 This is a line Here is another line This is yet another line Here is a fourth line file2 TEXT desired output This is a line TEXT Here is another line TEXT This is yet another... (6 Replies)
Discussion started by: jimmyf
6 Replies

10. UNIX for Beginners Questions & Answers

Search strings from a file in files in a directory recursively; then print the string with a status

Hi All, I hope somebody would be able to help me. I would need to search a string coming from a file, example file.txt: dog cat goat horse fish For every string, I would need to know if there are any files inside a directory(recursively) that contains the string regardless of case.... (9 Replies)
Discussion started by: kokoro
9 Replies
DublinCore::Element(3pm)				User Contributed Perl Documentation				  DublinCore::Element(3pm)

NAME
DublinCore::Element - Class for representing a Dublin Core element SYNOPSIS
my $element = DublinCore::Element->new( \%info ); print "content: ", $element->content(), " "; print "qualifier: ", $element->qualifier(), " "; print "language: ", $element->language(), " "; print "scheme: ", $element->scheme(), " "; DESCRIPTION
DublinCore::Record methods such as element(), elements(), title(), etc return DublinCore::Element objects as their result. These can be queried further to extract an elements content, qualifier, language, and schema. For a definition of these attributes please see RFC 2731 and <http://www.dublincore.org>. METHODS
new() The constructor. Take a hashref of input arguments. content() Gets and sets the content of the element. ## extract the element my $title = $record->element( 'title' ); print $title->content(); ## or you can chain them together print $record->element( 'title' )->content(); qualifier() Gets and sets the qualifier used by the element. language() Gets and sets the language of the content in element. scheme() Gets and sets the scheme used by the element. name() Gets and sets the element name (title, creator, date, etc). is_empty() Gets and sets the "empty" status of an element. This is useful when using DublinCore::Record's element() method. To see if the record has an creator elements: if( $record->element( 'creator' )->is_empty ) { # no creators } set() This function overrides the default set() behavior in order to remove the is_empty flag. SEE ALSO
* DublinCore::Record AUTHOR
* Ed Summers <ehs@pobox.com> * Brian Cassidy <bricas@cpan.org> COPYRIGHT AND LICENSE
Copyright 2007 by Ed Summers, Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.8 2007-11-24 DublinCore::Element(3pm)
All times are GMT -4. The time now is 12:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy