I am trying to write a 1 line command to search for a file with either a certain username or owned by a certain owner using ls and I/O redirection only. I was wondering if there is something like an “OR” statement in linux which would allow me to do this. What I have so far is
ls -l file1* OR ls -l|awk ‘{print $3}’|grep ishan
I need something to replace the OR here, coz at the moment I am getting a syntax error here.
I do not know where you have this statement from, but in reality there are two statemenst there, where the original writer says that you should use the one or the other. So you could use
ls -l|awk '{print $3}'|grep ishan
which btw should give you as many lines with the word *ishan *as there are files owned by *ishan in the working directory. *Is that really what you want? Else read the man page for *find *as ken_yap suggest, or formulate better what you want to achieve.
no need to use grep if using awk. awk does the job of grep and with more flexibility as its a programming language by itself, not just used for one liners