On 16:38 23 Sep 2002, Spanke, Alexander [EMAIL PROTECTED] wrote:
| Hi again,
|
| How can i count the lines of a text file and store it in a variable. But i
| should use the bash, so no perl, python script should it be.
|
| Now i use
| wc -l file.txt | read dummy
|
| But it doesn't work
Hi again,
How can i count the lines of a text file and store it in a variable. But i
should use the bash, so no perl, python script should it be.
Now i use
wc -l file.txt | read dummy
But it doesn't work :(
Any ideas ?
Regards / thnx
Alex
Try:
VAR=`wc -l /etc/passwd`
this way the $VAR gets the output of the command executed inside the ` `.
- Original Message -
From: Spanke, Alexander [EMAIL PROTECTED]
To: 'RedHat General - Mailinglist' [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 11:38 AM
Subject: Counting lines
On Mon, Sep 23, 2002 at 04:38:21PM +0200, Spanke, Alexander wrote:
How can i count the lines of a text file and store it in a variable. But i
should use the bash, so no perl, python script should it be.
[seyman@munshine seyman]$ linecount=`wc -l file.txt`
[seyman@munshine seyman]$ echo
Spanke, Alexander wrote:
Hi again,
How can i count the lines of a text file and store it in a variable. But i
should use the bash, so no perl, python script should it be.
Now i use
wc -l file.txt | read dummy
But it doesn't work :(
Any ideas ?
Regards / thnx
Alex