Unix Shell - Removing EOF character after a unix command

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2006 > Removing EOF character after a unix command





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Removing EOF character after a unix command
ktvarun@gmail.com

2006-10-23, 1:16 pm

Can anyone please throw some light on this issue.

When I give a command like
ls -ltcr | echo `awk '{print $9}'`

i get a list of files in the directory. But there is also an EOF
character after the last file that is displayed in the list.

Can i get the output without the EOF character.

FYI, I am giving this command inside DataStage ( a data warehousing
tool ). There an EOF character is treated as an error.

Thanks,
Varun

Janis

2006-10-23, 1:16 pm

ktvarun@gmail.com wrote:
>
> Can anyone please throw some light on this issue.
>
> When I give a command like
> ls -ltcr | echo `awk '{print $9}'`


Can you first throw some light on what you're trying to do!
(There are a lot of issues with that code.)

>
> i get a list of files in the directory.


If you just want the filenames why do you use option -l and
the (consequently) superfluous awk?

> But there is also an EOF
> character after the last file that is displayed in the list.


What EOF character are you talking about? There is no such
thing on Unix. Do you maybe mean a LF (or CR) character?

>
> Can i get the output without the EOF character.


Maybe all you want is something like...

printf "%s " $(ls -tcr )
echo $(ls -tcr )

(which have their caveats)
....or explain what you want to achieve.

Janis

>
> FYI, I am giving this command inside DataStage ( a data warehousing
> tool ). There an EOF character is treated as an error.
>
> Thanks,
> Varun


Bill Marcum

2006-10-23, 1:16 pm

On 23 Oct 2006 07:03:32 -0700, ktvarun@gmail.com
<ktvarun@gmail.com> wrote:
> Can anyone please throw some light on this issue.
>
> When I give a command like
> ls -ltcr | echo `awk '{print $9}'`
>
> i get a list of files in the directory. But there is also an EOF
> character after the last file that is displayed in the list.
>
> Can i get the output without the EOF character.
>

There is no EOF character in Unix. The character you are seeing must be
part of a file name. Rename the file.


--
The revolution will not be televised.
Barry Margolin

2006-10-24, 1:22 am

In article <1161612212.345298.235930@h48g2000cwc.googlegroups.com>,
ktvarun@gmail.com wrote:

> Can anyone please throw some light on this issue.


Only if you learn how to cross-post properly. This is the third thread
I've seen you start on the same topic.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
mr.bmonroe@gmail.com

2006-10-25, 7:15 pm

> What EOF character are you talking about? There is no such
> thing on Unix. Do you maybe mean a LF (or CR) character?


Janis,

Isn't ^d the "EOF" char (well, default char anyway)? I think it is
also referred to as ASCII char EOT. Though I think the parent is
confusing it with an ASCII NL.

--Brett

Janis Papanagnou

2006-10-25, 7:15 pm

mr.bmonroe@gmail.com wrote:
>
>
> Janis,
>
> Isn't ^d the "EOF" char (well, default char anyway)? I think it is
> also referred to as ASCII char EOT. Though I think the parent is
> confusing it with an ASCII NL.
>
> --Brett
>


If you inspect or dump files you won't see any EOT (= ASCII 4) character
on Unix; on end-of-file condition the OS functions notify this by a -1
return code (an integer value), but there's no character associated with
it.

You may trigger the EOF condition on a Unix terminal by typing <Ctrl>-D
(alone on a line) but there's no EOT *character* generated.

If you want a literal EOT (ASCII 4) to be generated on Unix through the
keyboard you have to escape that by first hitting <Ctrl>-V then <Ctrl>-D.

Janis
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com