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 ...
- 06-02-2010 #1Just 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
- 06-03-2010 #2Linux Guru
- 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:
That will do what you want.Code:cat filename - <<EOF
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-08-2010 #3Just Joined!
- Join Date
- Jun 2010
- Posts
- 4
Thank you very much Sir.. this really works
- 06-08-2010 #4Just 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?
- 06-08-2010 #5Linux Guru
- 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!


Reply With Quote