Find the answer to your Linux question:
Results 1 to 5 of 5
$ cat file1 aa bb cc $ cat file1 file1 aa bb cc aa bb cc $ cat <<EOF > x > y > EOF x y $ cat file1 ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    4

    <<EOF .. EOF is getting ignored as second argument

    $ cat file1
    aa
    bb
    cc
    $ cat file1 file1
    aa
    bb
    cc
    aa
    bb
    cc
    $ cat <<EOF
    > x
    > y
    > EOF
    x
    y
    $ cat file1 <<EOF
    > x
    > y
    > EOF
    aa
    bb
    cc


    Why is the output of the last command not like the following?
    aa
    bb
    cc
    x
    y

    OS information:
    $ uname -a
    Linux centos54-x1 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux
    $ echo $SHELL
    /bin/bash

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You need to do this in order to get stdin to output when the first argument is another file:
    Code:
    cat filename - <<EOF
    That will do what you want.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    4
    Thank you very much Sir.. this really works

  4. #4
    Just Joined!
    Join Date
    Jun 2010
    Posts
    4
    To extend my question a little more.. can I put a 3rd argument after - <<EOF and EOF similar to the 2nd argument?

    $ cat a1
    aa
    bb
    cc

    $ cat b1
    1
    2
    3


    This works..
    $ cat a1 - <<EOF b1
    > y
    > u
    > EOF
    aa
    bb
    cc
    y
    u
    1
    2
    3

    This doesn't work
    $ cat a1 - <<EOF - <<XYZ
    > r
    > t
    > EOF
    > y
    > i
    > XYZ
    aa
    bb
    cc
    y
    i

    Just curious, any way to make this work?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Glad to help. Good luck with your "bashing". Just remember two things:

    1. man pages are very useful
    2. google is your friend.

    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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