Reputation: 1189
i'm trying use one line of code to solve a problem
echo $(find . -maxdepth 1 -type f -newer $1 | sed 's,\.\/,,g')
this will print out all the file in current folder that are newer than the input file. But it prints out in one single line:
file1 file2 file3 file4....
how can i display each file name in a single line like:
file1
file2
file3
...
This seems to be a very simple but i've been searching and have no solution. Thank you in advance.
Upvotes: 3
Views: 1126
Reputation: 361585
Get rid of the echo
and the $(...)
.
find . -maxdepth 1 -type f -newer "$1" | sed 's,\.\/,,g'
If you have GNU find you can replace the sed
with a -printf
action:
find . -maxdepth 1 -type f -newer "$1" -printf '%P\n'
Upvotes: 6