Need help regarding String editing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help regarding String editing
# 1  
Old 06-29-2012
MySQL Need help regarding String editing

Hi Geeks

I am working on trimming the logs and extracting the XMLs from it. I am facing one problem here.

My XML String is ending with

...........Request></Body></Envelope>S/R

sometimes there is more then just S/R in the end.

I want to delete anything comes after </Envelope> Tag.

I tried AWK to find the position of envelope but it says string loo long.


Please provide some help here

Last edited by santy00110011; 06-29-2012 at 01:33 AM.. Reason: Forgot to add some stuff
# 2  
Old 06-29-2012
what you tried ?

post your awk command.

post sample log file and the expected output
# 3  
Old 06-29-2012
Resolved

I found the workaround and issue is resolved thanks.


Posting resolution, may be some one will find it useful.
Code:
cat rawXML2|sed -e 's/<\/Envelope>/<\/Envelope>\
    /g'|head -1> rawXML3


Last edited by Franklin52; 06-29-2012 at 04:10 AM.. Reason: Please use code tags for data and code samples
# 4  
Old 06-29-2012
Code:
$ echo '...........Request></Body></Envelope>S/R' | sed 's/Envelope\>.*/Envelope\>/'
...........Request></Body></Envelope>

This User Gave Thanks to itkamaraj For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert vi editing to text editing

Dear Guru's I'm using Putty and want to edit a file. I know we generally use vi editor to do it. As I'm not good in using vi editor, I want to convert the vi into something like text pad. Is there any option in Putty to do the same ? Thanks for your response. Srini (6 Replies)
Discussion started by: thummi9090
6 Replies

2. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

3. Shell Programming and Scripting

Editing part of the string

Hi guys got a problem here hope u all can help me. I learn that sed can actually edit a string but you need to know the old attribute to change to new 1. Example: sed "s/$title:$author/$title:$Nauthor/g" "Harry Potter - The Half Blood Prince:J.K Rowling:40.30:10:50" Each delimiter : represent... (4 Replies)
Discussion started by: GQiang
4 Replies

4. UNIX for Dummies Questions & Answers

Help with editing string elements

Hi All I have a question. I would like to edit some string characters by replacing with characters of choice located in another file. For example in sample file>S5_SK1.chr01 NNNNNNNNNNNNNNNNNNNCAGCATGCAATAAGGTGACATAGATATACCCACACACCACACCCTAACACTAACCCTAATCTAACCCTGGCCAACCTGTTT... (9 Replies)
Discussion started by: pawannoel
9 Replies

5. Shell Programming and Scripting

editing a file

i am writing a script to edit entries in a file. what command will edit a specific file? ex: echo) "what number would you like to change read "number" this is where I am stuck. what command will edit my specific file? (3 Replies)
Discussion started by: gustave
3 Replies

6. Homework & Coursework Questions

String editing using sed? awk?

1. The problem statement, all variables and given/known data: Problem Statement for project: When an account is created on the CS Unix network, a public html directory is created in the account's home directory. A default web page is put into that directory. Some users replace or... (13 Replies)
Discussion started by: peage1475
13 Replies

7. Programming

Editing or Adding to ELF string tables

Is it possible to add - or edit - data (the strings) contained within the string table of an ELF executable? I know I can access the string table with the following code; while ((scn = elf_nextscn(m_elf, scn)) != 0) { char *name = 0; gelf_getshdr(scn, &shdr); ... (9 Replies)
Discussion started by: Dhodder
9 Replies

8. Shell Programming and Scripting

SH Script help. editing string

I have a string that looks like this username|field1|field2|field3 the data has a delimiter of "|" how can i edit field1, keeping the rest of the data the same also how can i edit field2 and 3. (3 Replies)
Discussion started by: nookie
3 Replies

9. Shell Programming and Scripting

string editing in files

Hi all, I'm fairly new to scripting in linux and need some help. I have an file that looks something like this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Some comments # Some comments # Some comments # Some comments # Some comments # Some comments abc:/path/to/somewhere:X... (3 Replies)
Discussion started by: Avatar Gixxer
3 Replies

10. UNIX for Dummies Questions & Answers

Editing one string in multiple files

I am trying to edit multiple files from one directory and including all the files in all the sub directories. My string opens each file, puts the text on my screen and does not save the new information to the file. I am using a variable in my script, and wondering if that is what is choking it. ... (1 Reply)
Discussion started by: Skoshi
1 Replies
Login or Register to Ask a Question