0

Write a shell script that will take a filepath and a string as command line arguments. The script should find lines which contain the given 'string' in the given file. It should create an output file in "/tmp" directory with the name in the pattern as below. "NN_15Nov2013_12Hrs_32Minutes_20Seconds.txt"

4
Contributors
3
Replies
32
Views
3 Years
Discussion Span
Last Post by cmk001
0

Are you asking for help or just the answer? If it is the former please explain what you've tried and how you are stuck.

1

From your post it appears that you are running Linux/Unix, right? You are writing a bash script? If this is so, study the bash man page: man bash - that should provide you enough information to get started. We don't do your homework for you, but will help you sort out your problems once you have made a reasonable attempt to solve the problem and write the code.

FWIW (this is a hint), to write the data to the appropriate file name means you need to use the "date" command to format the date+time properly in order to generate the file name, and you will need to understand how backquoted commands work in bash.

Edited by rubberman

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.