Create a bash shell script to sort and then
uniq the file from the command line & store it to a new
file and output the results to the screen. Name this
script "sortAndUniq.sh"
Answer Posted / vipul dalwala
$1 is the filename u are passing from commnadline
i.e. sh sortAndUniq.sh filename.txt
So $1 = filename.txt
All the commnadline parameters passed to the script are get
stored in $1 , $2, $3....
For example : sh sortAndUniq.sh filename1.txt filename2.txt
filename3.txt
Then $1 = filename1.txt , $2 = filename2.txt , $3 =
filename3.txt
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is the difference between scripting and coding?
Is shell scripting difficult?
I have 2 files and I want to print the records which are common to both.
What are script files?
Given a file find the count of lines containing the word "abc".
How are shells born?
What is shift command in shell script?
How to print pid of the current shell?
How do I set bash as default shell mac?
Write a command sequence to find all the files modified in less than 2 days and print the record count of each.
How to find duplicate record in file using shell script?
How do I run a shell script in powershell?
Why is shell scripting important?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?
What is scripting used for?