Shell Script to take 2 inputs and process the result

view story

http://www.linuxquestions.org – Hi, I am a bit newbie to shell scripting. I want to write a script which takes two inputs 1. Name of the file, 2. No of lines to grep. After taking this two inputs the script should grep no of lines (input 2) from the file (input 1) and put the results into a new file. The new filename can be <filename>.<current date>. So for example if i run the script: # ./grepscript 100linesoflog.txt 10 This should create a new file called 100lineoflog.txt.20130524 which contains last 10 lines from 100linesoflog.txt Also if 100lineoflog.txt.20130524 already existed then the new file should be (HowTos)