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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] My sed command not give me a satisfy result
# 1  
Old 04-10-2012
[Solved] My sed command not give me a satisfy result

This is my command
Code:
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
(I meant consider the whole word)

but It's be
Code:
AlphabetTAlphabetEAlphabetSAlphabetT

Edited

I found solution

Code:
echo Test |sed -f <(sed 's/\(.*\),\(.*\)/s,\\<\1\\>,\2,gI/' mydic)


Last edited by radoulov; 04-10-2012 at 06:21 PM.. Reason: Solved
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tweak python program to give result in json

Hi , Below is the script which prints result in json but when i validate it has some tab or extra space issues. JSON result { "data": } This is the line I tweaked. Please advise. print "\t{", "\"{#NAME}\":\""+container+hn+"\"}" #!/usr/bin/env python # (2 Replies)
Discussion started by: ashokvpp
2 Replies

2. 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

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 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. ## /bin/sed -n '1,25p' ${file} >> ${MailFile} ... (3 Replies)
Discussion started by: millerg225
3 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

How to use the result from a command in SED

Hi all, this is my first post so go gentle. My goal is to use SED to add data to the end of lines in a file, then send the results to standard output. However, I want to add the result of another command to the end of the lines. Basically: sed 's/$/ insert command stuff here/' file.txtHere... (1 Reply)
Discussion started by: jsmith_4242
1 Replies

8. Shell Programming and Scripting

assign subst|grep|sed command result to a variable

Hi, I'm quite new to scripting and I want to modify following line of an existing script: MYVAR=`subst |grep 'L:\\\:' | sed -e 's/.*\\\//'`; What I have to do is to use the content of a variable instead of the constant expression 'L:\\\:' as the grep string to be matched. Assuming I already... (5 Replies)
Discussion started by: snowbiker99
5 Replies

9. UNIX for Advanced & Expert Users

executing script by cron doesnt give me expected result

Hi frnds... I m facing very irritating problem already waisted my 2 days.. I have a following script..( i am pasting only the main code) ftp -ivn 213.194.40.77 <<FTP user $user $password binary cd $FileDir/out lcd $localpath get $file rename $FileDir/out/$file $FileDir/tmp/$file... (1 Reply)
Discussion started by: clx
1 Replies

10. Shell Programming and Scripting

Can we give multiple patterns to a sed command???

HI, I want to know can multiple pattern be given inside a sed statement.. Input: aa_bb_cc.Mar-22-2007 cc_dd_ee.Mar-21-2007 aa_1002985_952.xml aa_bb_032207.txt aa_bb_cc_10002878.dat Output: aa_bb_cc cc_dd_ee aa.xml aa_bb.txt aa_bb_cc.dat (6 Replies)
Discussion started by: kumarsaravana_s
6 Replies
Login or Register to Ask a Question