Skip to content

Tag: unix

Word count after zgrep

I’m a little confused as to what this counts: Does it count the occurences of abcd in the 4 lines xyz? “wc -l” returns a different count than the number of lines present inside the file. Answer Prints every ‘xyz’ and 4 lines before from the file. zgrep -B 4 “xyz” <…

grep with star symbol

What is the difference between grep commands: and what is different if I search text as “text”. Answer grep requires (at least) two arguments — what you are searching for, and where you are searching for it. If the second argument is not provided, then it will use stdin instead. grep text* i…

How to use cut and paste commands as a single line command?

In Unix, I am trying to write a sequence of cut and paste commands (saving result of each command in a file) that inverts every name in the file(below) shortlist and places a coma after the last name(for example, bill johnson becomes johnson, bill). here is my file shortlist: I am able to cut from shortlist b…

How to traverse when using `cat` command? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago. Improve this question How to travel in the shell using cat command? (arrow keys are not working) Answer I think yo…

Why count differs between ls and ls -l linux command?

I had a directory with number of files and need to check the count of files present in it. I tried the following two commands: and found there are differences while using both commands. (ie. number of files is greater in the usage of second command while comparing to the first command.) I would like to know t…