Sponsored Content
Top Forums Shell Programming and Scripting How to get a string between two delimeters using sed. Post 302502008 by kchinnam on Sunday 6th of March 2011 01:24:40 PM
Old 03-06-2011
How to get a string between two delimeters using sed.

I want to get IP address only from the input using sed. i.e string between between "(" and ")" delimeters.

Code:
 
echo "serverA (11.22.333.444) is alive" | sed 's/<??>/<??>/'

I know how to do this using cut and awk's split features.

I also want to know how to do this using awk's multiple delimeter seperator syntax using something like FS="[(|)+]" but its not working [ echo "serverA (11.22.333.444) is alive" | gawk '{ FS = "[()]+" } { print $1 }' ].
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed problem - replacement string should be same length as matching string.

Hi guys, I hope you can help me with my problem. I have a text file that contains lines like this: 78 ANGELO -809.05 79 ANGELO2 -5,000.06 I need to find all occurences of amounts that are negative and replace them with x's 78 ANGELO xxxxxxx 79... (4 Replies)
Discussion started by: amangeles
4 Replies

2. Shell Programming and Scripting

awk with two delimeters

Hi, can anyone explain me below codes...i used the below one to use two delimeter(://) at a time.. but i am not able to understand the output options.. note: here there is no requirement ..only to understand myself about below command... command: awk -F "" '{print $1}' inputfile ... (2 Replies)
Discussion started by: Shahul
2 Replies

3. Shell Programming and Scripting

awk with column delimeters

Hi All, I want to execute this cat /etc/passwd | awk -F: '{print $1,$7}' with a fixed column on the first and second. Say on the first I want 12 column and second with 20 column. Example root /usr/bin/ksh lp /bin/false Thanks for any comment you may add. (5 Replies)
Discussion started by: itik
5 Replies

4. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

5. Shell Programming and Scripting

Commas within Delimeters

Hi experts, I would like a favour from you guys to get the info from 5th column which was separated by the delimeter comma ( , ) The Data file is as below:- 1,USER1,"90, TEST AVENUE, OLD ROAD",test1,124,N 2,USER2,88 TEST STREET NEW ROAD,test2,123,N The User File is as below:- USER1... (1 Reply)
Discussion started by: shenkz
1 Replies

6. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

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

8. Shell Programming and Scripting

Lines between specific delimeters

Hi, I have a requirement like this Line 1 Line 2 Line 3 Manager Line 4 Line 5 I have to print like this Have you done your work on time because I have to forward the work forward. Any Help is really Appriciated.... (1 Reply)
Discussion started by: abhishek7687
1 Replies

9. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies

10. Shell Programming and Scripting

Replace last 9 delimeters “,” with “|” in UNIX

Hi Guys, I want to replace last 9 "," delimeters with "|" in a file Example :- "ashu,pant",3,5,5,7,7,87,8,8,8 "ashu,pant"|3|5|5|7|7|87|8|8|8 Help would be really appreciated. Thanks guys, Please use CODE tags as required by forum rules! (7 Replies)
Discussion started by: himanshupant
7 Replies
PFM Format Description(5)					File Formats Manual					 PFM Format Description(5)

NAME
PFM - PFM graphic image file format DESCRIPTION
This document describes the PFM graphic image file format as understood by the Netpbm converters pamtopfm(1) and pfmtopam(1) There are multiple similar formats known as PFM in the world, none of them authoritatively documented. The format described here is one that Bryan Henderson deduced from a program he found somewhere that dealt with a 'PFM' format. The PFM format is inspired by the Netpbm formats, and you will see lots of similarity. It is not, however, an official Netpbm format. Its goal is not consistent with those of Netpbm formats. The format A PFM image is a stream of bytes. The stream consists of a header followed immediately by a raster. These two components are described below. There are no delimeters before or after the sections as described. PFM header The PFM header is 3 consecutive 'lines' of ASCII text. After each line is a white space character. That character is typically a newline character, hence the term 'line,' but doesn't have to be. pamtopfm uses a newline in the PFM it generates. Identifier Line The identifier line contains the characters 'PF' or 'Pf'. PF means it's a color PFM. Pf means it's a grayscale PFM. Dimensions Line The dimensions line contains two positive decimal integers, separated by a blank. The first is the width of the image; the second is the height. Both are in pixels. Scale Factor / Endianness The Scale Factor / Endianness line is a queer line that jams endianness information into an otherwise sane description of a scale. The line consists of a nonzero decimal number, not necessarily an integer. If the number is negative, that means the PFM raster is little endian. Otherwise, it is big endian. The absolute value of the number is the scale factor for the image. The scale factor tells the units of the samples in the raster. You use somehow it along with some separately understood unit information to turn a sample value into something meaningful, such as watts per square meter. PFM raster The raster is a sequence of pixels, packed one after another, with no delimiters of any kind. They are grouped by row, with the pixels in each row ordered left to right and the rows ordered bottom to top. Each pixel consists of 1 or 3 samples, packed one after another, with no delimiters of any kind. 1 sample for a grayscale PFM and 3 for a color PFM (see the Identifier Line of the PFM header). Each sample consists of 4 consecutive bytes. The bytes represent a 32 bit string, in either big endian or little endian format, as deter- mined by the Scale Factor / Endianness line of the PFM header. That string is an IEEE 32 bit floating point number code. Since that's the same format that most CPUs and compiler use, you can usually just make a program use the bytes directly as a floating point number, after taking care of the endianness variation. netpbm documentation 19 April 2012 PFM Format Description(5)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy