This topic has been archived. It cannot be replied.
-
工作学习 / IT杂谈 / Anyone knows how to do it in the Unix shell scriptI forget how to set a variable to the result of one command
for example:
set DDD head -n 1 /etc/passwd
echo $DDD
but it doesn't work.
Thanks
-oceandeep(我想看看北极熊);
2002-9-3
{154}
(#726216@0)
-
I found the answeronce I tried
DDD='date'
but it should be
DDD=`date`
haha
-oceandeep(我想看看北极熊);
2002-9-3
{71}
(#726255@0)
-
Another question found!!!how to get last 1000 lines of a file
because the file has many lines and there is a limitation in the command "tail",
this command can't return many lines.
or how to get the 2nd or 3rd line of a file in unix shell
thanks
-oceandeep(我想看看北极熊);
2002-9-3
{233}
(#726386@0)
-
The answer.When you ask the question later , you should tell us which shell
you are using.
how to get last 1000 lines of a file ?
# tail -1000 <filename>
how to get the 2nd or 3rd line of a file in unix shell ?
# head -n 3 <filename> | tail -2
-fyq2002(失意人生);
2002-9-11
{242}
(#740522@0)