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"
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / roopa
hey can you please tell me what is the avlue of $1
and how do we specify that in our script?
| Is This Answer Correct ? | 1 Yes | 0 No |
sort $1 | uniq > output | echo "`cat output`"
| Is This Answer Correct ? | 1 Yes | 2 No |
When you login to a c shell, which script would be run first?
What are the advantages of shell script?
What does $@ mean in shell?
How to get the 3rd element/column from each line from a file?
How to modify the PATH variable and make it executable?
What is shell scripting?
What is shell and terminal?
How to find duplicate record in file using shell script?
0 Answers IBM, Saama Tech, Wipro,
Given a file find the count of lines containing the word "abc".
What is the use of a shebang line?
What is sh in shell script?
what is info area how many types?