![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract a string from main string | madhu.it | Shell Programming and Scripting | 1 | 10-06-2008 04:05 AM |
| extract a sub string from a main string | madhu.it | Shell Programming and Scripting | 5 | 10-04-2008 02:22 AM |
| Extract content from several txt-files | larsu | Shell Programming and Scripting | 7 | 06-17-2008 03:52 AM |
| Content extract of a file using awk | nr_shan | Shell Programming and Scripting | 5 | 12-19-2007 05:22 AM |
| How to extract a portion of a string from the whole string | ds_sastry | UNIX for Dummies Questions & Answers | 2 | 09-29-2001 10:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Help to extract the content in this string
Hi All,
I have a string in the following format: "kf skjgsdjgngnsd sdgsd ksjgbksjgb kjsbgsjdgb dfhdh sjgsjg j jsbekgjsbdkgj". In this format i want to extract the contents which is in between the two empty lines: i.e, i want to extract the following "ksjgbksjgb kjsbgsjdgb dfhdh ". Please help me in this. Thanks in advance. Regards, Bala |
|
||||
|
Hi,
I'm a beginer in UNIX. I have tried using cut with regular expressions. but that doesnt work.The Problem is i'll not be having the string in a file. It comes out of some other operations and the format of that o\p is as given below in the previous post. can u please explain me the command u gave, what is the use of that infile. The String will be dynamic. it can be anything but only the pattern will be same. That is i have to extract all the string between two new lines. Thanks in advance, Bala |
|
||||
|
Hi,
I tried the following thing. comment1 = $(echo "$comment1" | sed -n '/^$/,/^$/ {/[^ ]/p}'). where comment1 has the string which shuld be formatted. But it's saying that: sed: command garbled: /^$/,/^$/ {/[^ ]/p}. Is there anything wrong with the regex we are using. Regards, Bala |
|
|||||
|
I am not sure what you are going to do. If you echo "$comment1", what do you get? Is the output you want to parse in a variable? If it is just the output of a command, try using that command and put a pipe | behind that command followed by the sed command. If it is a file, use it as I did above. If there is no reason to force the text into a variable, don't do it.
|
|
||||
|
try saving that string to a file.its easier that way even though you have to create a file.
you can then use: string = `more <filename>` then use the string variable to extract that text with the sed command. you can always delete the file once you are done with rm. |
| Sponsored Links | ||
|
|