Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extracting Multiple String in a File Post 302951643 by Don Cragun on Saturday 8th of August 2015 05:05:11 PM
Old 08-08-2015
Quote:
Originally Posted by Aia
Thank you for the feedback, specially, since it was nothing more than an approximation of what I interpreted you were looking for. Nevertheless, if it would have not been, it could have been fixed by providing more feedback based on the output of it.
For me, it is never a waste of time.
Hi Aia,
If you look back at the earlier posts in this thread, you'll note that I provided code that did exactly what the OP requested and asked for details describing how we were supposed to determine what text was supposed to be extracted from an input file. The response so far has been that with x as input, y is the desired output.

You provided a great piece of code that didn't produce the output requested for any of the three sample input lines the OP posted. Apparently the OP has a solution that meets his or her requirements, but since we don't really know what those requirements are, I don't see how either of us can write code to meet those requirements.

- Don
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, grep, awk, regex -- extracting a matched substring from a file/string

Ok, I'm stumped and can't seem to find relevant info. (I'm not even sure, I might have asked something similar before.): I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies

2. Shell Programming and Scripting

Extracting a string from one file and searching the same string in other files

Hi, Need to extract a string from one file and search the same in other files. Ex: I have file1 of hundred lines with no delimiters not even space. I have 3 more files. I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
Discussion started by: mohancrr
1 Replies

3. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies

4. Shell Programming and Scripting

Extracting data between tags based on search string from unix file

Input file is on Linux box and the input file has data in just one line with 1699741696 characters. Sample Input: <xxx><document coll="uspatfull" version="0"><CMSdoc>xxxantivirus</CMSdoc><tag1>1</tag1></document><document coll="uspatfull"... (5 Replies)
Discussion started by: gaya
5 Replies

5. Shell Programming and Scripting

Extracting particular string in a file and storing matched string in output file

Hi , I have input file and i want to extract below strings <msisdn xmlns="">0492001956</ msisdn> => numaber inside brackets <resCode>3000</resCode> => 3000 needs to be extracted <resMessage>Request time getBalances_PSM.c(37): d out</resMessage></ns2:getBalancesResponse> => the word... (14 Replies)
Discussion started by: sushmab82
14 Replies

6. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

7. Shell Programming and Scripting

Extracting string before first dash in a file name

Hi all, Given a file name such as EXAMPLE=lastname-02.30.71-firstname-town-other.tar.gz How do I print everything before the first dash (i.e. lastname) Note: I do not know exactly how many dashes or what information there will be in each file name so it is important that the code... (2 Replies)
Discussion started by: bashnewbee
2 Replies

8. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

9. Shell Programming and Scripting

Extracting Multiple Lines from a Text File

Hello. I am sorry if this is a common question but through all my searching, I haven't found an answer which matches what I want to do. I am looking for a sed command that will parse through a large text file and extract lines that start with specific words (which are repeated throughout the... (4 Replies)
Discussion started by: MrDumbQuestion
4 Replies
TIFFCHECK(8)						      System Manager's Manual						      TIFFCHECK(8)

NAME
tiffcheck - check TIFF for HylaFAX conversion requirements SYNOPSIS
/usr/sbin/tiffcheck [ options ] file.tif DESCRIPTION
tiffcheck takes TIFF input and writes a multi-line text message to the standard output describing any work needed to prepare the images for facsimile transmission. tiffcheck is usually invoked by tiff2fax(8) script that is used by the HylaFAX scheduler to prepare TIFF documents submitted for transmission. The first line of output is a series of ``+''-separated words that indicate if the input file should be: o rejected (``REJECT''), o reformatted with a different data-encoding scheme (``REFORMAT''), o scaled to different page dimensions (``RESIZE''), o reimaged in a different vertical resolution (``REVRES''), or o reimaged for other reasons such as conversion from color to black&white (``REIMAGE''). The conversion requirements string will always have keywords in the above order; e.g. ``RESIZE+REVRES'' if the input file needs to be scaled and converted to a different resolution. Information following the first line is descriptive text that explains the reason(s) for the file conversion(s); this text is suitable for return to a client (should document conversion fail or not be attempted). The descrip- tive text is ordered identically to the keywords in the conversion string; this makes it possible to match up conversion requirements to reasons. OPTIONS
The following operations are recognized: -1 Set output to be Group 3 1D-encoded. -2 Set output to be Group 3 2D-encoded. -3 Set output to be Group 4 MMR-encoded. -w width Set the output page width, in pixels. By default, pages are 1728 pixels wide. -l length Set the output page length in millimeters. By default, pages are 297 millimeters long. -r vres Set the vertical resolution, in lines/inch, at which to image the TIFF. EXAMPLES
The following color image needs to be converted to black&white, resized to the output page dimensions, and reformatted to use Group 3 1D- encoded data. hyla% /usr/sbin/tiffcheck jello.tif REFORMAT+RESIZE+REIMAGE Document is not a bilevel image (bits/sample 8). Document requires reformatting, not in Group 3 format. Document requires resizing to adjust page width (convert to 1728, document is 256). This image is a facsimile received at high resolution (196 lpi); it only needs to be converted to 98 lpi. hyla% /usr/sbin/tiffcheck faxix.tif REVRES Document requires reformatting to adjust vertical resolution (convert to 98, document is 196). SEE ALSO
tiff2fax(8), faxq(8), hylafax-server(5) January 18, 1996 TIFFCHECK(8)
All times are GMT -4. The time now is 07:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy