I have a set of files in a directory named
abc
data.txt
hello
hello1
hello1.text
hello.txt
I want to list only the files hello and hello1.
I tried using this command ls -lrt hello* | ls -lrt !(hello*.*)
The output which I got is
abc
data.txt
hello
hello1
The pipe function is not working in this scenario.
Please help me with this issue
since you tagged with grep, give this a try:
ls -l |grep 'hello1\?$'
if the digit could be dynamic, try this
ls -l|grep 'hello[0-9]*$'