![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regular expression to extract "y" from "abc/x.y.z" .... i need regular expression | rag84dec | Linux | 2 | 05-29-2008 01:05 AM |
| #!/bin/sh script fails at StringA | tr "[x]" "[y]" | by_tg | UNIX for Dummies Questions & Answers | 3 | 02-22-2008 08:17 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 09:52 PM |
| Shell Script fails with "can't connect to client" | sseenu79 | HP-UX | 2 | 12-20-2006 06:47 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
"sed -n expression " fails. Why?
Hi Everyone!
I am trying to extract records between date makers in a log file. My selection string doesn't work, though. Please help. This test works, if I manually enter the two date-strings (output=28 lines): Code:
# sed -n '/\[20051213\]/,/\[20051214\]/p' ./access_log eg1 (output=ZERO lines): Code:
# DF="20051213"; DT="20051214"; export DF DT
# sed -n '/\[`echo ${DF}`\]/,/\[`echo ${DT}`\]/p' ./access_log
Code:
# DF="20051213"; DT="20051214"; export DF DT
# echo "'/\[${DF}\]/,/\[${DT}\]/'" > /tmp/sed_file
# cat /tmp/sed_file
# '/\[20051213\]/,/\[20051214\]/' ## note: contents of /tmp/sed_file
# sed -n --file=/tmp/sed_file ./tangofreaks_access_log
# sed: file /tmp/sed_file line 1: Unknown command: `''
Please help! Thanks GrahamB Last edited by grahamb; 12-14-2005 at 04:31 AM. Reason: Clearer view of "CODE" |
| Forum Sponsor | ||
|
|