Computing.Net > Forums > Unix > gen. new string from a text file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

gen. new string from a text file

Reply to Message Icon

Name: walterwaston
Date: October 6, 2007 at 22:24:01 Pacific
OS: Unix
CPU/Ram: Unix
Product: Unix
Comment:

Hi,

I have a file and the content looks like this:

line1
line2
File #5 : found
'/u01/testing.txt'
line5
line6
line7
File #12 : found
'/u01/testabc.txt'
line10
line11

I want to write a bash shell script to give me the output:

The file 5 is '/u01/testing.txt'
The file 12 is '/u01/testabc.txt'


As I am new in shell script, can anyone tell me how to do this?

Thanks!!
Walter




Sponsored Link
Ads by Google

Response Number 1
Name: Devaraj (by Fidy)
Date: October 7, 2007 at 19:49:57 Pacific
Reply:

awk '/found/{no=substr($0,6,2);next;print "The file", $no,"is",$0}'

Regards,
Devaraj Takhellambam


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: gen. new string from a text file

Remove blanks from a text file www.computing.net/answers/unix/remove-blanks-from-a-text-file/6582.html

Print certain line from a text file www.computing.net/answers/unix/print-certain-line-from-a-text-file/6955.html

Parsing and emailing a text file www.computing.net/answers/unix/parsing-and-emailing-a-text-file-/6623.html