Replace in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace in ksh
# 8  
Old 05-09-2013
Do you mean like this?
Code:
sed 's/^\\/del "/; s/$/"/' file

This User Gave Thanks to Scrutinizer For This Post:
# 9  
Old 05-09-2013
Quote:
Originally Posted by Scrutinizer
Do you mean like this?
Code:
sed 's/^\\/del "/; s/$/"/' file

yes perfect.. thanks for quick reply
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to replace string in AIX ksh shell

My variable contains the following string I wish to replace \n with "space" so the expected output is: I understand that the /n is not a new linein this case. I'm on AIX using ksh shell. Below is all that I tried. echo $str | sed -e "s#\n# #g"; echo $str | sed -e "s#\n#' '#g";... (5 Replies)
Discussion started by: mohtashims
5 Replies

2. Shell Programming and Scripting

How to replace all ip addresses in all files in directory in ksh?

Hi All, I have a directory containing a lot of files and I want to search all files which contains IP addresses pattern and want to replace those ip addresses with equal number of, say, some character, 'x'. So after replacement the file should not contain any IP address. Like 10.122.53.5 ->... (3 Replies)
Discussion started by: sanzee007
3 Replies

3. Shell Programming and Scripting

ksh Remove and replace repeated in file

Hi, i need to read a line from a file and count the number of times it appear in, then continuous to the second line with the same. So when i count a line i have to remove all duplicates in the file to not count it another time. while read line do n=$(grep -c $line File) print "$line... (5 Replies)
Discussion started by: ToniX
5 Replies

4. Shell Programming and Scripting

Using sed in ksh to find and replace string

Hi All, I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) - /dd/pp/test/test/1/ /pp/aa/test/dg1/ /dd/pp/test/test/2/ /pp/aa/test/dg2/ /dd/pp/test/test/3/... (2 Replies)
Discussion started by: pandeyra
2 Replies

5. Shell Programming and Scripting

Replace in KSH

Hello, i want to replace a string AAAA to BBB in a file using script. File: 1 2 AAAA 3 4 5 old=AAAA new=BBB cat $file_name | while read line; do if ;then sed -e 's/$old/$new/' fi done (5 Replies)
Discussion started by: LiorAmitai
5 Replies

6. Shell Programming and Scripting

Replace string in ksh

Hello, I want to locate a special character in each line of a file and replace it with another string that contains a special character and $i (i is incresing each cycle) string1: export IBAN=AAAAAAAAA . . . . export IBAN=zzzzzzzzzzz I want it to be: export IBAN=AAAAAAAAA . export... (1 Reply)
Discussion started by: LiorAmitai
1 Replies

7. Shell Programming and Scripting

Ksh: Replace backslash characters

Hi All, I have a requirement to read a line from a file with some search string, replace any backslash characters in that line and store in a variable. Shell script: replace.ksh #!/bin/bash file2=input.rtf line=`grep "Invoice Number" ${file2} | head -1 | sed 's/\\//g'` echo "start... (6 Replies)
Discussion started by: prashas_d
6 Replies

8. Shell Programming and Scripting

Find and Replace in ksh.

Hi Experts, I have a directory which have 500 ksh, they all have common path string. I have replaced all the ksh in different directory so i need to change the path string. Please help me how to search and replace it. Thanks SKG (1 Reply)
Discussion started by: gauravsunil
1 Replies

9. Shell Programming and Scripting

Find/replace to new file: ksh -> perl

I have korn shell script that genretaets 100 file based on template replacing the number. The template file is as below: $ cat template file number: NUMBER The shell script is as below: $ cat gen.sh #!/bin/ksh i=1; while ((i <= 100)); do sed "s/NUMBER/$i/" template > file_${i} ((... (1 Reply)
Discussion started by: McLan
1 Replies

10. Shell Programming and Scripting

Search and Replace in Ksh

All I need a code in Ksh to search and replace a string in a file. File A --- AAAA A BBBB B CCCC C DDDD E FFFF F File B: -------- AAAA BBBB CCCC DDDD (9 Replies)
Discussion started by: DeepakXavier
9 Replies
Login or Register to Ask a Question