Sed to handle newline specific name modifiication


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sed to handle newline specific name modifiication
# 8  
Old 06-19-2009
Hi Vasanth,

I did not get , what the problem your facing. for your reference i am attaching the data i tested and the output i got.
# 9  
Old 06-19-2009
Input file attached herewith

Dear Panyam,

Thanks. But my input file is little different, i am attaching for your reference.

While posting, the tab space character is removed.

Thanks
Vasanth
# 10  
Old 06-19-2009
Thanks but....

For the above input file, the awk script is failing to give desired output.

Thanks In advance,
Vasanth
# 11  
Old 06-19-2009
adding a tab solves the problem.
Code:
awk -F"=" '/c1 \{/,/\}/ {OFS="=";if($1=="       axis") $1="     axis1"; }\
 /c2 \{/,/\}/ {if($1==" width") $1="    width2" ; if($1=="      height") $1="   height2" }\
 { print }' input_file.txt

"[TAB key]axis"

# 12  
Old 06-19-2009
yes....

Thanks...

Vasanth
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert a newline after match in files of specific name under some subdirectories?

Hi I'd like to add the newline: \tuser: nobody", or "<TAB>user: nobody to all files named: docker-compose.ymlin subfolders of pwd with names beginning with 10-20. Within these files, I'd like to find the line (there'll only be one) containing: command: celery workerNOTE: As far as... (2 Replies)
Discussion started by: duncanbetts
2 Replies

2. Shell Programming and Scripting

How to replace NewLine with comma using sed?

Hi , I have a huge file with following records and I want to replace the last comma with ',NULL'. I try using SED but could not create a correct script . In my opinion I need a script which can convert ,/n with ,NULL/n 1,CHANGE_MEMBER,2010-12-28 00:05:00, 2,CHANGE_MEMBER,2012-09-02... (8 Replies)
Discussion started by: Ajaypal
8 Replies

3. Shell Programming and Scripting

Why SED can't see the last newline character?

Removed. My question does not make sense. and SED does see the last newline character. But I still have a question: How to remove the last newline character(the newline character at the end of last line) using SED? ---------- Post updated 05-01-11 at 10:51 AM ---------- Previous update was... (7 Replies)
Discussion started by: kevintse
7 Replies

4. Shell Programming and Scripting

AWK/SED: handle max chars in a line

Hi all, I hope you guys can help me. I prefer SED/AWK solutions if possible. For my shame it didn't work for me :o ISSUE: :wall: 1\3 1/$4\@7\ 1234567890123456789\ 1234567890123456789,\ 1234567890123456789\ 123456789012 12345 1234567890123456789\ 1234567890123456789,\ 1234... (5 Replies)
Discussion started by: unknown7
5 Replies

5. Shell Programming and Scripting

sed newline

Hi everyone, I'd like to use the script validatehtml which returns either the given url is HTML strict or not, using http:// validator . w3 . org . sh validatehtml #!/bin/bash wget -q http:// validator . w3 .org / check?uri=$1 cat check\?uri\=$1 | sed -n '/h2/ p' | sed 's/ */ /g' | sed... (2 Replies)
Discussion started by: azertyazerty
2 Replies

6. Shell Programming and Scripting

sed newline to tab ,problem

Input: gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly sed 's/\n/\t/g' infile It's not working. Output should be: gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly (5 Replies)
Discussion started by: cola
5 Replies

7. Shell Programming and Scripting

using awk removing newline and specific position

Hello Friends, Input File looks as follows: >FASTA Header1 line1 line2 line3 linen >FASTA Header2 Line1 Line2 linen >FASTA Header3 and so on ....... Output: Want something as: >FASTA Header1 line1line2line3linen >FASTA Header2 (5 Replies)
Discussion started by: Deep9000
5 Replies

8. Shell Programming and Scripting

add newline in file after finding specific text

Hi All, I am tring to insert a newline with "/" in a text file whenever there is the text "end;" right now I have inside file: . . end; I want to have: . . end; / I tried doing the following within the file :g/^end;/s//end; \/ / (4 Replies)
Discussion started by: jxh461
4 Replies

9. Shell Programming and Scripting

Sed to handle newline specific name modifiication

Hi, The below link clarification required... https://www.unix.com/shell-programming-scripting/112523-sed-handle-newline-specific-name-modifiication.html Vasanth (1 Reply)
Discussion started by: vasanth_vadalur
1 Replies

10. Shell Programming and Scripting

how to handle variables in sed

while read line do str1=`grep 'customernumberR11' file1 | cut -c 20-21` str2=`grep 'newnumberR11' file1 | cut -c 15-16` if ; then sed -e "s/newnumberR11/ s/$str2/\$str1/g" $line fi done < file1 (4 Replies)
Discussion started by: LAKSHMI NARAYAN
4 Replies
Login or Register to Ask a Question