Extracting Multiple String in a File


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Extracting Multiple String in a File
# 15  
Old 08-09-2015
Hi bakunin,

I did respond to Don's direct explanation of his frustration about the less than consistence information from the OP, out of sense of courtesy. Never I said I did not agree with his point.
I am sorry, if you, somehow, feel I did wrong, but I do not feel the need to debate with you. Don't get offended.

~ Aia

Last edited by Aia; 08-09-2015 at 02:56 PM..
# 16  
Old 08-14-2015
Hello Don, Aia, and Bakunin...
Firstly, I would like to thank you and apologize...
Maybe, I'm not yet familiar or knowledgeable for some terms or words that you are using or words that technically use in UNIX world. Or, I couldn't able to understand your requirements.

Anyways, about the solution that Aia provided, Don you are exactly right that there are some lines that really don't match on the columns and won't matched the output but at least I have an idea on how to resolve my concern.

Thank you once again.

Regards...
# 17  
Old 08-14-2015
Quote:
Originally Posted by WPGPoseidon
Hello Don, Aia, and Bakunin...
Firstly, I would like to thank you and apologize...
No apologies needed because no offense was taken.

Quote:
Originally Posted by WPGPoseidon
Maybe, I'm not yet familiar or knowledgeable for some terms or words that you are using or words that technically use in UNIX world. Or, I couldn't able to understand your requirements.
That is OK. Our general modus operandi in such cases is to question the provided requirements as long as it takes until they are clearly defined. This is not trying to chastise you - not at all! But "i need X" is difficult to fulfill unless "X" is not defined. I could quote you reams of threads that go like this:

Quote:
Q: i need X
A: provides some X
Q: ahh, yes, but in fact the Xs are more like Ys
A: modifies his solution
Q: better yet, but sometimes there is no X but a Z instead
A: modifies his solution again
Q: Thats very good now. Is it possible to make every third Z an A?
A: quietly hangs himself on a power cable.
Quote:
Originally Posted by WPGPoseidon
Anyways, about the solution that Aia provided, Don you are exactly right that there are some lines that really don't match on the columns and won't matched the output
This is exactly what Don and i were talking about. If Aias solution did help you - all the better. Kudos to him. But Don and i try to first find out the whole problem and then do it right. Aia is convinced that providing something first off helps better.

It is not my place to judge and it is Aias right to use his time as he pleases. If he exerts more effort than might be needed: maybe, but he alone is the judge if this is wasted effort or not.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

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

9. 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
Login or Register to Ask a Question