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
c program to display the information of given file similar to givan by the unix or linux command ls -l
How would you compare the strings in a shell script?
What is shell and shell script?
I want to connect to a remote server and execute some commands, how can I achieve this?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
What is sudo command?
Is powershell a language?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
How do I run a powershell script?
What are the zombie processes?
What is bash command used for?
What is k shell?
How to print all the arguments provided to the script?
write a shell script to emulate the Id command of PRIMOS which lists files and directories. It list files first with a header FILES and then directories with a header DIRECTORIES. This command has several options. The main ones are. -file select files only -dir select directories only -reverse sort in reverse order -no_header put no header on the output -brief output the header only -size display the size of each file -help display Id´s syntax and options.
How to print the first array element?