Having problems figuring out these commands
1. Can you please give me an example of a command that would display a text file named myfile.txt and sort it on the same command line using the pipe command to join the two parts together.
(This is a Scenerio) 2. I have a log file named logins.txt that monitors logins to my system. It contains multiple lines with duplicate user names. What command could I use so that I could display the file showing only one instance of every login? 3. If I have a script named, myscript.sh, what is the syntax for running it at the command prompt? 4. What command would I use to give me the last 20 lines of a file called inventory.txt? :) |
Re: Having problems figuring out these commands
Quote:
Another option is to call like so /bin/sh myscript.sh Quote:
|
1. cat myfile.txt | sort --dictionary-order
2. cat logins.txt | sort --unique 3. If you CD to the directory which contains myscript.sh, then ./myscript.sh will execute the script, assuming execute permissions are set. The ./ tells Bash that the script is located in the current working directory. Otherwise, from anywhere, /path/to/myscript.sh will work also work. 4. tail -n 20 inventory.txt |
All times are GMT -5. The time now is 01:00 AM. |