I have a file.txt that contains multiple lines similar from below and I would like to extract to other file in a tab/space delimiter some certain values or field.
I would expect to execute a 'cat' command of the file.txt then do a PIPE '|' and may need to use a sed/cut/awk command to extract multiple strings in a file.
OUTPUT:
Highly appreciate any help.
Thanks.
Last edited by WPGPoseidon; 08-07-2015 at 03:23 PM..
Reason: Add CODE tags.
Thank you for the response.
The below String is what I am expecting to be printed and the rest will be discarded.
Output:
I'd just made the below lines as generic string.
Moderator's Comments:
Please use CODE tags as required for forum rules when displaying sample input, output, and code segments.
If there is no logic to describe what characters are to be included or excluded, here is the command you want to produce the output you want from an arbitrary input string:
If there is no logic to describe what characters are to be included or excluded, here is the command you want to produce the output you want from an arbitrary input string:
Hi Don,
That content is in a filename.txt that I need to 'cat' and so I will be expecting to get an ouput to be printed with those string.
I repeat, if there are no rules describing what is to be extracted from a file and what is to be ignored in a file other than specifying the output you want, echo will give you what you want. If using cat to produce your output is important, you can slow down the echo and get the same results with:
Hi Don,
There are multiple files or 1 file of text file that contains different entries for each line that I will expect to grab the string/field for each line.
OUTPUT
Example of the Output
I would expect to execute a 'cat' command of the file.txt then do a PIPE '|' and may need to use a sed/cut/awk command to extract multiple strings in a file.
Thank you.
Last edited by Don Cragun; 08-07-2015 at 04:09 PM..
Reason: Add CODE tags again.
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)
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)
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)
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)
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)
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)
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)
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)
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)