can we get o/p of
ls | wc - l
command on the same line.
[root blg]# ls nc*010412* | wc -l
23
[root blg]# ls nc*010412* | wc -l
24
[root blg]# ls nc*050412* | wc -l
21
[root blg]# ls nc*040412* | wc -l
23
[root blg]# ls nc*070412* | wc -l
22
my expectation is grepping specific lines from the file and getting output like this
010412 23
050412 24
040412 23
070412 22
dt=010412;echo $dt $(ls nc*$dt*|wc -l)
will not work for 2 reasons:
1) the requirement is to get the number of files with the pattern and not the number of lines in the files.
2) the first output line will be
wc: 0653-755 Cannot open cat.
.
dear
text contents are
^[]0;root blg]# ls nc*010412* | wc -l
24
^[]0;root blg]# ls nc*010412* | wc -l
24
^[]0;root blg]# ls nc*010412* | wc -l
24
^[]0;root blg]# ls nc*010412* | wc -l
24
error msg is
dt=010412;echo $dt $(ls nc*$dt*|wc -l) <sagar1.txt
nc*010412* not found
010412 0
i m not clear but if you want to use ls and wc commd with together, maybe try this
# echo "ls nc*010412*|wc -l"|awk '{x=$0;gsub(/nc\*|\*\|wc/,"",$2);printf "%s\t",$2;system(x)}'
error msg is like this
sh: root^G[: not found.
0
sh: 24: not found.
blg]# sh: ^[]0: not found.
This is unclear..
This will not work, you cannot redirect into echo...
Could you post the content of sagar1.txt
?
sagar1 is attached here with
thanks for the reply