Sponsored Content
Full Discussion: SED with Special characters
Top Forums Shell Programming and Scripting SED with Special characters Post 302485732 by Scrutinizer on Thursday 6th of January 2011 04:40:54 AM
Old 01-06-2011
You could try this:
Code:
sed -i "/outbound-callerid/r"<(echo "                        \$ext->add(\$context, \$exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:\${CALLERID(nummer)}@carrier.com>'))\;/") infile

If you are using ksh93/bash

or get the linenumber first:
Code:
sed -i "13s/$/\n                        \$ext->add(\$context, \$exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:\${CALLERID(nummer)}@carrier.com>'))\;/" infile

so, for example:
Code:
sed -i "$(grep -nm1 outbound-callerid infile | sed 's/:.*//')s/$/\n                        \$ext->add(\$context, \$exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:\${CALLERID(nummer)}@carrier.com>'))\;/" infile


Last edited by Scrutinizer; 01-06-2011 at 06:00 AM..
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed with special characters

i have this script that searches for a pattern. However it fails if the pattern includes some special characters. So far, it fails with the following strings: 1. -Cr 2. $Mj 3. H'412 would a sed or awk be more effective? i don't want the users to put the (\) during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies

2. Shell Programming and Scripting

Changing Special Characters Using Sed

Hi. Does anyone know how to use the sed command to change the special border characters on this .per file. I have to edit about 80 .per files. I need a sed script to change the below 3 and A characters. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Test Islands, Office of Public Health -- WIC... (4 Replies)
Discussion started by: cstovall
4 Replies

3. Shell Programming and Scripting

sed with special characters

Hi, I am reading a file (GC_JAR.log) which has entries like: 511725.629, 0.1122672 secs] 525268.975, 0.1240036 secs] 527181.835, 0.2068215 secs] 527914.287, 0.2884801 secs] 528457.134, 0.2548725 secs] I want to replace all the entries of "secs]" with just "secs" Thus, the output... (4 Replies)
Discussion started by: itzz.me
4 Replies

4. Shell Programming and Scripting

sed with many special characters

I started with this: counter1=1 cp file.txt file_${counter1}.tmp while read name1 do echo $name1 counter2=`expr $counter1 + 1` sed /'${name1}'/d file_${counter1}.txt > file_${counter2}.txt counter1=`expr $counter1 + 1` done < source.txtsource.txt contains the... (1 Reply)
Discussion started by: lakanino
1 Replies

5. Shell Programming and Scripting

Using sed to replace special characters

Hi everyone I have file1 contains: '7832' ' 8765 6543 I want a sed command that will format as: '7832' , '8765' , '6543' I tried sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2 sed -e :a -e '$!N; s/\n/ /; ta' file2 which gives: 7832 8765 6543 I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies

6. Shell Programming and Scripting

Escape special characters in SED

Need help in escaping special characters in sed command. Here is the the string which i am trying to find a replace with From :- REQUEST_TYPE=PIXEL&amp;MSG_ID={//MESSAGE_ID} To :- REQUEST_TYPE=PIXEL&amp;MSG_ID= X_EDELIVERY_MESSAGE_ID &amp; BATCH_ID= X_EDELIVERY_BATCH_ID Here is the sed command i am... (2 Replies)
Discussion started by: aakishore
2 Replies

7. Shell Programming and Scripting

sed special characters issue

Hi I'm trying to replace string1 by string2 in file homepage.htm as follows but is not working. Please Help: sedsed -i "s@'://your server name:port/test/owa'@'://11.22.33.44:5555/pls/SAMPLE'@g" homepage.htm Where, String1 ://your server name:port/test/owa String2... (3 Replies)
Discussion started by: koazter
3 Replies

8. Shell Programming and Scripting

Sed - remove special characters

Hi, I have a file with this line, it's always in the first line: I want to remove these special characters: ´╗┐ file1 ´╗┐\\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35 Bytes;2 ;1 I want the same file to be only \\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35... (4 Replies)
Discussion started by: nakaedu
4 Replies

9. Shell Programming and Scripting

sed special characters issues

I am dusting off the sed cobwebs and had a basic question: I have a file that contains: $firewall = "on"; $cache = "on"; $dataset{'mary had a little lamb'} = "on"; and want to only change the contents of what is between the single quotes: $dataset{'big bad wolf'} = "on"; I... (3 Replies)
Discussion started by: metallica1973
3 Replies

10. Shell Programming and Scripting

sed in a while loop with special characters

I have the foolowing data file: File1 <p name="A">5004</p> <p name="B">5004</p> <p name="C">5004</p> <p name="A">15004</p> <p name="B">15004</p> <p name="C">15004</p> In a while loop using sed (100 of line need to be replace), I need the output to File3:... (2 Replies)
Discussion started by: bobo
2 Replies
callerid.conf(5)					    Linux System Administration 					  callerid.conf(5)

NAME
/etc/isdn/callerid.conf - config file for isdnlog numbers and scripts FORMAT
This file has the format described in isdnformat(5). It must be owned by root, and only root may have write access. Every user can create his private telephone book as ~/.isdn with the same file format. VARIABLES SECTION
Like in isdn.conf, this file has an optional [VARIABLES] section. All variable names must be uppercase. Warning: variables in callerid.conf will override variables in isdn.conf, and variables in ~/.isdn will override variables in both files. First all variables are read, then they are substituted, so a variable defined in ~/.isdn can be used in isdn.conf. This might be a security hole. However, if programs are to be run as root, these files (and the program) cannot be writeable for non-root users. Using variables: if a reference to a non existing variable is used, isdnrep and isdnlog will give warning messages, and use the variable name (e.g if $FRED isn't set, isdnlog will use "$FRED"). The dollar sign can be backslashed if a real dollar sign is needed instead of variable substitution (e.g. $PATH will be "$PATH"). NUMBER and MSN In [NUMBER] sections, you can supply information for the outer world, in [MSN] sections; you can supply information about your msns. The format is the same: NUMBER=xxxx Set the telephone number. This should be your msn or the telephone number with area code (with or without areprefix, countrycode and countryprefix) SI=x Service indicator. Isdnlog knows these service indicators: 1 speech (telephone, fax g3, modem etc.) 2 restricted digital information 3 unrestricted digital information with tones/announcements 4 video 7 unrestricted digital information (hdlc, x.75 etc.) Alias=xxxx Supply a name as alias (e.g. ALIAS=Fred's Number) ZONE=xxx Only useful with remote numbers: billing zone for connections to this number: 0 internal connection in your s0 bus (no charge) 1 city area 2 region 50 3 region 200 4 far region 5 the same as 1 INTERFACE=xxx Isdn network interface. This information is required with the "-hx" / hangup="value" option. START You can define a subsection here. The whole section is ignored unless you gave the "-S" / start=yes option. Each subsection should have the name [FLAG]. It may hold these values: FLAGS=x|y|z Combine these flags (with or without the pipe "|" char; with is preferred) to get the combination you want: Part 1: Incoming and Outgoing I Incoming call O Outgoing call Part 2: Signals from isdn system C Connect (can be used with interval, see below) B Busy E Error R Ring (can be used with interval, see below) A AOCD (advice of charge signal) H Hangup Part 3: Modifiers L Start the program again and again every time it terminates. U Start the program only once within a interval. Without this, several instances of a program can run in parallel. (Interval required.) K Kill program at the end of the interval. USER=xxx Isdnlog will not run programs as root, and will switch to a different user id for security. You must give the name or uid of the user isdnlog has to use here. GROUP=xxx Isdnlog will not run programs as group root, and will switch to a different group id for security. You must give the name or gid of the groups isdnlog has to use here. TIME=xx Restrict this flag to a special time. Pleas read isdntime(5). INTERVAL=xx With connect (C) or ring (R) flag you can specify an interval, so isdnlog will start the program after every interval. The interval is in seconds and should be at least 2 seconds. If the flags do not include C or R, this option is ignored. PROGRAM=xxx The program you want to start, with the required arguments. You may use the following special tokens: $1 flags that caused execution, e.g. "IR", "OC". There are always exactly two characters. $2 Caller number (complete with area code). $3 Called number (complete with area code). $4 Time the connection started. Example: "Wed May 28 23:07:44 1997". Contains "?" if there is no connection yet (e.g. still at RING phase). $5 Duration of connection up to now (in seconds). $6 Time the connection ended. Same format as $4. $7 Number of input bytes. $8 Number of output bytes. $9 Input bytes per second. $10 Output bytes per second. $11 Service indicator. $12 Charges. $13 Caller country code. $14 Called country code. $15 Caller area code. $16 Called area code. $17 Caller town (derived from area code). $18 Called town $19 Caller alias. $20 Called alias. Note: within a string you must use ${1} ${2} ... FILES
/etc/isdn/callerid.conf This file. ~/.isdn Per user telephone book. SEE ALSO
isdnlog(8) isdnformat(5) isdntime(5) AUTHOR
This manual page was written by Andreas Jellinghaus <aj@dungeon.inka.de>, for Debian GNU/Linux and isdn4linux. ISDN 4 Linux 3.1pre4 2000/09/15 callerid.conf(5)
All times are GMT -4. The time now is 11:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy