## sed usage with special characters - text manipulation

sed usage with special characters - text manipulation
# 8
08-09-2009
Quote:
Originally Posted by TheMrOrange
need to replace delete empty lines and write chars in the line above the line deleted
What chars?
Can you post a more precise sample of your input file and the desired output (within code tags)?
 Franklin52 View Public Profile for Franklin52 Find all posts by Franklin52
# 9
08-09-2009
Quote:
Originally Posted by dr.house
Understand how the given solutions works and modify to your requirement.
The above code with a little modification will meet you requirement.
 edidataguy View Public Profile for edidataguy Find all posts by edidataguy
# 10
08-10-2009
Quote:
Originally Posted by edidataguy
Understand how the given solutions works and modify to your requirement.
The above code with a little modification will meet you requirement.
this works perfectly!
I get the solution using grep for all lines not empty but your solution is much better and I'm going to use it. (thanks)

Anyway I've the last problem to solve:
even if I use your code or mine (that use grep), I always have an empty line at the end of the output-file (fileOUT.txt). The input-file (fileIN.txt) have an empty line at the end as well as the output.
Do you know how I can delete also the last empty line?
 TheMrOrange View Public Profile for TheMrOrange Find all posts by TheMrOrange
# 11
08-10-2009
If you post all your requirements at one time, you will have a better solution.
This does not care if the last line is empty on not.
It just deletes it.

This deletes all blank lines, not just the last one.
 edidataguy View Public Profile for edidataguy Find all posts by edidataguy

## Remove Special Characters Within Text

Hi, I have a "|" delimited file that is exported from a database. There is one column in the file which has description/comments entered by some application user. It has "Control-M" character and "New Line" character in between the text. Hence, when i export the data, this record with the new...

## 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:...

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

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

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

## SED with Special characters

Hello All Seeking the right one SED command. My attempt is: From orginal.txt by SED to target.txt sed -i "/('outbound-callerid/a\$ext->add($context, $exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:${CALLERID(nummer)}@carrier.com>'));" orginal.txtWhat am make wrong?:wall: ...

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

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

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

## help on sed replacing special characters

Hello, I have a file with many lines with below format: \abc\\1234 jkl\\567 def\\345 \pqr\\567 \xyz\\234 Here, i need to do 2 things. 1. replace \\ with \ 2. remove starting \ so output to be as below: