Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > how to read a file using shell ??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-07, 13:13
ranga2727 ranga2727 is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
how to read a file using shell ??

Hello

i have a file in directory which has some values like this

lets assume the file is $p
ttry_rtyy_trree

and i am using a file as an input as ($Y) in a shell once i start the shell it should read the file $p and $Y once those lines are matched in $Y i want to take a copy of that line and lines which are below 7 lines and put it in a output file ($Z)
$Y has this
ttry_rtyy_trree
66341251111
14567888888
12323434343
23232454544
2323234354
354545476767
67676767676676
9834587957457439
100192903203239

and my Output file after extracting should be exactly like this

ttry_rtyy_trree
66341251111
14567888888
12323434343
23232454544
2323234354
354545476767

Thanks!!
Reply With Quote
  #2 (permalink)  
Old 09-18-07, 11:49
ranga2727 ranga2727 is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
Thumbs up

can anyone help me on this ..
this is kinda urgent .. Here is the clear picture of what i need :

i have a mainfile (backup file) a.txt

and i have a constant file b.txt which will be added or deleted

lets assume i have the following contents in a.txt :

unix:workinshellscripting
samplethings
sample
condition
success
failure

unix:shell
cool
ice
work
place
history

and b.txt has
workinshellscripting

once i run the shell script it should read the param file and read the value in the backup files

and once the string is found it has to copy the contents (5 lines below) and paste it in an output file

hence my outputfile has these

unix:workinshellscripting
samplethings
sample
condition
success
failure
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On