Results 1 to 3 of 3
Hey there gurus, fans, and students alike! I have another Q about sed. First let me show you my almost working scenario:
Code:
#!/bin/bash
QTDO="/mmc/mmca1/.system/QTDownLoad/CKC"
BUSY="$QTDO/busybox"
EZXP="$QTDO/ezxpopup"
SHOW="$QTDO/showQ"
YAN0="$QTDO/yan0_notes"
# ...
- 09-11-2007 #1Just Joined!
- Join Date
- Aug 2007
- Posts
- 8
Bash Scripting: Is this possible?
Hey there gurus, fans, and students alike! I have another Q about sed. First let me show you my almost working scenario:
What I am trying to do is end up with a file like this:Code:#!/bin/bash QTDO="/mmc/mmca1/.system/QTDownLoad/CKC" BUSY="$QTDO/busybox" EZXP="$QTDO/ezxpopup" SHOW="$QTDO/showQ" YAN0="$QTDO/yan0_notes" # ezxpopup and showQ are binaries that allow GUI interaction b/w the user and phone. # yan0_notes is a unix text editor for my phone, the ROKR e6. # ezx_hardkey.cfg is a config file that contains app codes that are set to some a custom key, and a carrier set key (non customizable from the phone). echo '' > name NAME="$(cat name)" $BUSY awk '/customizedKey/ {print $3}' ezx_hardkey.cfg > code sed -e 's/$/ $NAME/' code > new cat new >> list
I need the space between the appcode and the appname.Code:8a2b9b37-83e7-a8d9-82cf-0bcbe2070002 AppNameHere
How can I use sed in that way? Would I have to write a sed script?
To be clear, I need the sed command to find the end of the line, add a space and the inputed string from the NAME variable, or the name file... Is this even possible? I've searched all over the net and couldn't find a single article about sed that mentioned recalling variables or files within the sed statement. Thanks everyone!
- 09-11-2007 #2Just Joined!
- Join Date
- Mar 2006
- Posts
- 5
- 09-11-2007 #3Just Joined!
- Join Date
- Aug 2007
- Posts
- 37
I don't see why you need the files 'name', 'code' and 'new', nor why you use 'cat' and 'sed'.
Code:#!/bin/bash QTDO="/mmc/mmca1/.system/QTDownLoad/CKC" BUSY="$QTDO/busybox" NAME="Rosegarden" $BUSY awk -v shell_var=" $NAME" '/customizedKey/ {print $3 shell_var}' ezx_hardkey.cfg >>list


Reply With Quote
