I can not find "/ls.txt", gives an error for a slash.
du -a | awk '{if(//ls.txt$){print $2}}'
//ls.txt$
This is an incorrect regular expression entry. will be correct:
/ls.txt$/
and if you need to include in the expression and slash, then it must be "zaasekit":
/\/ls.txt$/
ps by the way, and you have an extra conditional operator. The awk program can immediately select lines that fall under a regular expression:
awk '/выражение/{действия}'
in your example:
$ du -a | awk '/\/ls.txt$/{print $2}'
Source: https://ru.stackoverflow.com/questions/968052/
All Articles