I need to get a section of a file based on 2 params. I want the part of the file between param 1 & 2. I have tried a bunch of ways and just can't seem to get it right. Can someone please help me out.....its much appreciated. Here is what I have found that looks like what I want....but doesn't give me back the right stuff.
is that it can't read the $Param passed in. When I put some text instead of the param it does it fine. One problem I have is the param will have slashes in it (the param is a full path filename). Does anyone know how to get it to read the param with slashes in it. Here is what it will look like...
sed -n '/$PARAM1/,/$PARAM2/p'
With the params uncovered it is
sed -n '//directory/filename/,//directory/filename2/p'
Try putting double quotes around the command and single quotes around the PARAM
sed -n "/'$PARAM1'/,/'$PARAM2'/p"
or if you are putting it in the other format then you can just use the backslash to tell the script to treat the forward slash as a character and not an argument like
sed -n '/\/directory\/filename/,/\/directory\/filename2/p'
I have tried the suggestions you guys gave and it looks like they are close but not quite right. If I put them in double quotes it says its garbled. It does recognize the params but just can't handle them. I also switched / to # sign and put brackets around param and doesn't come back with anything.