Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007
    Posts
    11

    Unanswered: 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!!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •