Ask a Question related to UNIX Programming, Design and Development.
-
Barry Margolin #1
Re: How to list the first 10 lines error from executing command
In article <1673c1fd.0307291148.7fd25c2e@posting.google.com >,
John <johnwu@yorku.ca> wrote:javac file.java 2>&1 | head -10>Hello All
>
>I know this is a common question, but I didn't know how to search and
>get its answer, say if the following command end up with lots lines of
>error,
>
>javac file.java
>javac find error:file.java error 1111
>file.java:error 22222...
>....
>
>how to let it just displaying the first 10 lines of error, something
>like
>
>more a_file | head -10 #or
>cat a_file | grep "myError"
2>&1 means to redirect stderr to where stdout goes, and then you can use
the familiar piping of stdout to post-process that.
--
Barry Margolin, [email]barry.margolin@level3.com[/email]
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
Barry Margolin Guest
-
List with Grid Lines
I found a flex portal site that shows a list on the left hand side of the site divided by gridlines. Does anyone know how to make this happen or... -
Error executing child request for error.aspx
We are getting errror when load control is added(ascx) as "Error executing child request for error.aspx" it thows an error after calling the... -
command list
Are you sure they're numbers and not strings? l = put l.max() -- 1100 l = put l.max() -- "930" -
executing a shell command within a function
Hi, I’m coding a function that will create a set of directories using execution of shell commands within the function. Then the function saves... -
executing "DB2 load command" from perl return errors
On 1 Jul 2003, Kenjis Kaan wrote: LOAD is not an SQL statement, it is a command. Therefore it can't be executed via DBI (or JDBC, ODBC, etc). ... -
Joe Halpin #2
Re: How to list the first 10 lines error from executing command
[email]johnwu@yorku.ca[/email] (John) writes:
Try> Hello All
>
> I know this is a common question, but I didn't know how to search
> and get its answer, say if the following command end up with lots
> lines of error,
>
> javac file.java
> javac find error:file.java error 1111
> file.java:error 22222...
> ....
>
> how to let it just displaying the first 10 lines of error, something
> like
>
> more a_file | head -10 #or
> cat a_file | grep "myError"
javac file.java 2>&1 >/dev/null | head -10
Joe
Joe Halpin Guest
-
JohnWu #3
Re: How to list the first 10 lines error from executing command
"Joe Halpin" <jhalpin@nortelnetworks.com_.nospam> wrote in message
news:yxs7n0exm6zv.fsf@nortelnetworks.com_.nospam.. .Thanks, Joe> Try
>
> javac file.java 2>&1 >/dev/null | head -10
>
> Joe
In sh, it works, but I'm using tcsh and csh, it said that it was ambiguous
redirect output, do you mind telling me again how to do it for tcsh, or csh?
--
Best Regards
John
JohnWu Guest
-
Chris F.A. Johnson #4
Re: How to list the first 10 lines error from executing command
On Wed, 30 Jul 2003 at 01:34 GMT, JohnWu wrote:
Redirection is one of the things that [t]csh doesn't handle well.>
> "Joe Halpin" <jhalpin@nortelnetworks.com_.nospam> wrote in message
> news:yxs7n0exm6zv.fsf@nortelnetworks.com_.nospam.. .>>> Try
>>
>> javac file.java 2>&1 >/dev/null | head -10
> In sh, it works, but I'm using tcsh and csh, it said that it was ambiguous
> redirect output, do you mind telling me again how to do it for tcsh, or csh?
Why don't you use a Bourne-type shell? [T]csh is not recommended
for scripting.
--
Chris F.A. Johnson [url]http://cfaj.freeshell.org[/url]
================================================== =================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
Chris F.A. Johnson Guest
-
JohnWu #5
Re: How to list the first 10 lines error from executing command
"Chris F.A. Johnson" <c.f.a.johnson@rogers.com> wrote in message
news:bg7ciq$lhnck$1@ID-136730.news.uni-berlin.de...Bourne Shell is better, I agree. The things to me are, my account's default> Redirection is one of the things that [t]csh doesn't handle well.
>
> Why don't you use a Bourne-type shell? [T]csh is not recommended
> for scripting.
>
shell is set to tcsh, and some of the commands linked to DB2 and other
softwares only work in tcsh (guess this can be fixed).
Anyway, the inconvenience for me to use Bourne Shell is that, I don't know
how to set up or configure the environment, so that whenever login to my
account in Solaris 5.8, the (Left and Right) arrows keys can display the
command histroy,so that long command line can be issued by a Arrow key
javac -classpath ..... file.java .....
--
Thanks
John
JohnWu Guest
-
JohnWu #6
Re: How to list the first 10 lines error from executing command
> You can't redirect stderr separate from stdout in csh, only both, like
Thanks lots, that's what I wanted.> this:
>
> javac file.java |& head -10
> javac file.java |& more
>
> (man csh:
> A simple command, or a set of simple commands separated by |
> or |& characters, forms a pipeline. With |, the standard output
> of the preceding command is redirected to the standard input of
> the command that follows. With |&, both the standard error and
> the standard output are redirected through the pipeline.
> )
>
One more thing regarding Bourne-sh, as asked in previous thread, in sh, how
to set Arrow key to display history command, as in csh?
--
John
Toronto
JohnWu Guest
-
Joe Halpin #7
Re: How to list the first 10 lines error from executing command
"JohnWu" <johnwu@yorku.ca> writes:
If you use korn shell or bash you get (IMO) better command line recall> "Chris F.A. Johnson" <c.f.a.johnson@rogers.com> wrote in message
> news:bg7ciq$lhnck$1@ID-136730.news.uni-berlin.de...> Bourne Shell is better, I agree. The things to me are, my account's> > Redirection is one of the things that [t]csh doesn't handle well.
> >
> > Why don't you use a Bourne-type shell? [T]csh is not recommended
> > for scripting.
> >
> default shell is set to tcsh, and some of the commands linked to DB2
> and other softwares only work in tcsh (guess this can be fixed).
>
> Anyway, the inconvenience for me to use Bourne Shell is that, I
> don't know how to set up or configure the environment, so that
> whenever login to my account in Solaris 5.8, the (Left and Right)
> arrows keys can display the command histroy,so that long command
> line can be issued by a Arrow key javac -classpath ..... file.java
and editing than with csh, and you can choose between vi and emacs
editing modes.
Take a look at
[url]http://www.faqs.org/faqs/unix-faq/shell/shell-differences/[/url]
Joe
Joe Halpin Guest
-
Ralf Fassel #8
Re: How to list the first 10 lines error from executing command
* "JohnWu" <johnwu@yorku.ca>
| One more thing regarding Bourne-sh, as asked in previous thread, in
| sh, how to set Arrow key to display history command, as in csh?
You can't do this neither in plain sh, nor in regular csh. You can do
this in tcsh (enhanced version of csh) and in bash (enhanced GNU
version of sh). Other shells may have other editing features (such as
ksh's vi mode).
R'
Ralf Fassel Guest
-
joe@invalid.address #9
Re: How to list the first 10 lines error from executing command
Ralf Fassel <ralfixx@gmx.de> writes:
In emacs mode (at least - I don't use vi mode) ksh and bash can both> * "JohnWu" <johnwu@yorku.ca>
> | One more thing regarding Bourne-sh, as asked in previous thread, in
> | sh, how to set Arrow key to display history command, as in csh?
>
> You can't do this neither in plain sh, nor in regular csh. You can do
> this in tcsh (enhanced version of csh) and in bash (enhanced GNU
> version of sh). Other shells may have other editing features (such as
> ksh's vi mode).
use the arrow keys for command line recall. ksh needs some aliases
setup, but bash seems to do it builtin.
Joe
joe@invalid.address Guest



Reply With Quote

