Examples based on filters in Linux.
Links that you may find important :
Sort :
http://linux.about.com/library/cmd/blcmdl1_sort.htm
http://linux.about.com/od/commands/a/Example-Uses-Of-The-Command-Sort.htm
https://www.ibm.com/developerworks/community/blogs/58e72888-6340-46ac-b488-d31aa4058e9c/entry/linux_sort_command_sort_lines_of_text_files9?lang=en
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Tuesday, 2 July 2013
Tuesday, 25 June 2013
Shell script to rename files based on suffix
Given below is a Shell script to rename files based on suffix.
Links that you may find important :
http://linux.about.com/od/commands/l/blcmdl1_ls.htm
http://en.wikipedia.org/wiki/Ls
http://linux.about.com/library/cmd/blcmdl1_wc.htm
http://www.computerhope.com/unix/uwc.htm
http://en.wikipedia.org/wiki/Wc_%28Unix%29
http://en.wikipedia.org/wiki/Cut_%28Unix%29
Links that you may find important :
http://linux.about.com/od/commands/l/blcmdl1_ls.htm
http://en.wikipedia.org/wiki/Ls
http://linux.about.com/library/cmd/blcmdl1_wc.htm
http://www.computerhope.com/unix/uwc.htm
http://en.wikipedia.org/wiki/Wc_%28Unix%29
http://en.wikipedia.org/wiki/Cut_%28Unix%29
Saturday, 22 June 2013
Shell scripting using general-purpose utilities - Menu driven program
Given below is a menu driven shell script which will print the following menu and execute the given task to display result on standard output.
MENU
1 Display calendar of current month
2 Display today’s date and time
3 Display usernames those are currently logged in the system
4 Display current directory
5 Display your terminal number
6 Exit
MENU
1 Display calendar of current month
2 Display today’s date and time
3 Display usernames those are currently logged in the system
4 Display current directory
5 Display your terminal number
6 Exit
Friday, 14 June 2013
Shell script to display prime numbers
Bash script to display prime numbers.
Links that you may find important :
https://en.wikipedia.org/wiki/Prime_number
http://en.wikipedia.org/wiki/List_of_prime_numbers
http://en.wikipedia.org/wiki/2_%28number%29
Code :
Links that you may find important :
https://en.wikipedia.org/wiki/Prime_number
http://en.wikipedia.org/wiki/List_of_prime_numbers
http://en.wikipedia.org/wiki/2_%28number%29
Code :
echo 'Enter no' read x n=2 while [ $n -le $x ] do i=2 count=1 while [ $i -lt $n ] do if [ `expr $n % $i` -eq 0 ] then count=0 break fi i=`expr $i + 1` done if [ $count -eq 1 ] then echo "$n is Prime" fi n=`expr $n + 1` doneOutput :
2 is Prime 3 is Prime 5 is Prime 7 is PrimeNote : Leave a comment if you feel the program is incorrect and/or has errors and/or if the program and its output don't match. Please report about broken links.
Subscribe to:
Posts (Atom)