awk-outputting input line in specified output line

awk-outputting input line in specified output line

Post by Ian Thoma » Thu, 30 Sep 1999 04:00:00



Hello,

    I have a question about awk that I have asked a number of people
about but have had no joy with. A colleague have mine has suggested that
I submit the question to this newsgroup to see if anyone can help me.

Basically is there a way that I can use awk to extract a line from an
input file and put it into an output file on a specific line number i.e.

Input file contents

Hello there how are you
today. I am fine thank
you

If I use awk '/today/' input_file to extract the line today. I am fine
thank

Is there a way that I can output the line 'today. I am fine thank' on
for instance line 5 in the output file?

Output file contents

blank line
blank line
blank line
blank line
today. I am fine thank

I would appreciate any help with this.

Thanks

Ian

 
 
 

1. awk-outputting input lines on specified line number

Hello,

    I have a question about awk that I have asked a number of people
about but have had no joy with. A colleague have mine has suggested that

I submit the question to this newsgroup to see if anyone can help me.

Basically is there a way that I can use awk to extract a line from an
input file and put it into an output file on a specific line number i.e.

Input file contents

Hello there how are you
today. I am fine thank
you

If I use awk '/today/' input_file to extract the line today. I am fine
thank

Is there a way that I can output the line 'today. I am fine thank' on
for instance line 5 in the output file?

Output file contents

blank line
blank line
blank line
blank line
today. I am fine thank

I would appreciate any help with this.

Thanks

Ian

2. Multiple writers to an fd

3. Perl script log file output has duplicate copies of output lines

4. Impossible Networking Idea?

5. Question about reading the output of a command line by line

6. rest of: Segmentation fault in Linux 2.0.x NFS

7. Terminal on serial line accepts input, no output

8. CacheFS vs squid vs harvest vs ...

9. awk: output of more than just the matching line

10. sed: output modified lines only with command file input

11. using sed/awk to output lines following a pattern

12. how to specify all blank lines as record separators in awk.

13. How can awk can read the following lines of a line searched?