[SOLVED] sed command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [SOLVED] sed command
# 1  
Old 08-31-2012
[SOLVED] sed command

Help request,

I have tsted this line of code for hours. The first line works and the second line returns the message " sed: command garbled.....". This
is running on solaris. The "${} variables all have good values when echoed.
Code:
 ##       /bin/sed -n '1,25p' ${file} >> ${MailFile}
           /bin/sed -n '${start},${end}\p' ${file} >> ${MailFile}

(script output)
Code:
sed: command garbled: ${start},${end}\p

Thank you
GRM

Last edited by Franklin52; 09-03-2012 at 03:29 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 08-31-2012
Code:
 sed -n "${start},${end}p" file

# 3  
Old 08-31-2012
fyi , your example give the same results. "sed: command garbled: ${start},${end}p "
Thank you for your efforts, GRM

---------- Post updated at 12:14 PM ---------- Previous update was at 11:02 AM ----------

pravin27, I did not see the double quote at first. Your command is correctly working.
Thank you, GRM
# 4  
Old 08-31-2012
I ran pravin27's sed command on my Solaris 9 box running ksh and it works fine.

What shell are you using??
Perhaps the shell is not evaluating the command line arguments correctly.

Just for fun, try eval'ing this command and see what happens:

Code:
mycmd='sed -n "${start},${end}p" ${file}'
eval $mycmd

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] sed command help

Hello all. Im trying very hard to figure this out, but Im a newbie. I have a file that looks like this.... 6315551234 NJ224 5162224567 SUFF Im trying to put a command together that will make it into this.... UM,6315551234,,,,,NJ224,0 UM,5162224567,,,,,SUFF,0 Im all over the... (7 Replies)
Discussion started by: jay11789
7 Replies

2. Shell Programming and Scripting

[Solved] sed

sed -e 's/console/raw/g' this command will replace the letter pradeep with rawat what if i want to replace a word like FRIENDS with a space simultaneously from the same file i m replacing pradeep. im doing this sed -e 's/console/raw/g' && sed 's/FRIENDS//g' but i dono why this is not happening. (2 Replies)
Discussion started by: console
2 Replies

3. Shell Programming and Scripting

[Solved] Sed error - multiple number options to `s' command

Hi All, I am having two files (file1 & file2) and a filelist.txt file below. file1: $$STRINGVAR1=5 $$STRINGVAR2=10 $$LAST_UPD_DT_TBL1=12/12/2010 12:00:00 $$STRINGVAR3=100 $$LAST_UPD_DT_TBL2=01/01/2010 12:00:00... (8 Replies)
Discussion started by: Chandru_Raj
8 Replies

4. Shell Programming and Scripting

[Solved] SED - Bash - Inserting multi Tab character in the command

Hello. I am using : sed -i -e '/§name_script§/a#'"${MY_TAB11}"'# \ #'"${MY_TAB1}"'The Standard way'"${MY_TAB7}"'# \ #'"${MY_TAB1}"'==============='"${MY_TAB7}"'# \ ' "$CUR_FILE" Is there a better way to define "MY_TAB7","MY_TAB11" in other way than : MY_TAB1=$'\t' MY_TAB2=${MY_TAB1}$'\t'... (2 Replies)
Discussion started by: jcdole
2 Replies

5. Shell Programming and Scripting

[SOLVED] sed -i not available in solaris 5.10

Hi All, i'm writing a script where i have to grep for a pattern and the 3 lines after the pattern and comment them out. Note that i have to do this for multiple files, i am able to grep the pattern and the next 3 lines but since solaris does not recognize the -i option, i was wondering if... (11 Replies)
Discussion started by: Irishboy24
11 Replies

6. UNIX for Dummies Questions & Answers

[solved]Help with a sed command

So I have a bunch of strings in a file. Example Line ./prcol/trt/conf/conf-app/jobdefinition/trt-pre-extr-trt-step.jdef Intended Result pre-extr-trt-step So far I have parsed it out to the last bit, echo $line | cut -d'/' -f7 | cut -d. -f1Result trt-pre-extr-trt-step So I added a... (2 Replies)
Discussion started by: J-Man
2 Replies

7. Shell Programming and Scripting

[Solved] My sed command not give me a satisfy result

This is my command echo "Test" | sed -f <(sed -e 's/.*/s,&,gI/' mydic) In mydic file,containing 2 columns delimit by comma (,) a,AlphabetA . . . e,AlphabetE . . s,AlphabetS . t,AlphabetT test,testedd . . zebra,zebraaaa The expect result is testedd (0 Replies)
Discussion started by: Runicer
0 Replies

8. Shell Programming and Scripting

[solved] how to separate using sed !

dears, hope evryone doing good in his work , i have a question about something important : how can i use 'sed' so in a script automatically it will take an enter before the number 1 in this line so 2 commands will be taken insted of one big command ?... (0 Replies)
Discussion started by: semaan
0 Replies

9. Shell Programming and Scripting

Solved: AWK SED HELP

Hi, I need to process a file as below. Could you please help to achieve that using awk/sed commands. Input file: --------------- AB | "abcdef 12345" | 7r5561451.pdf PQRST | "fghfghf hgkjgtjhghb ghhgjhg hghjghg " | 76er6ry.pdf 12345 | "fghfgcv uytdywe bww76 jkh7dscbc 78 : nvchtry hbuyt"... (0 Replies)
Discussion started by: viveksr
0 Replies

10. Shell Programming and Scripting

can this been solved with awk and sed?

Hi Masters, ___________________________________________________________________________________ Group of orthologs #1. Best score 3010 bits Score difference with first non-orthologous sequence - yeast:3010 human:2754 YHR165C 100.00% PRP8_HUMAN 100.00%... (16 Replies)
Discussion started by: mskcc
16 Replies
Login or Register to Ask a Question