Sponsored Content
Top Forums Shell Programming and Scripting Extract lines between 2 strings add white space Post 302440192 by dcfargo on Monday 26th of July 2010 11:47:26 AM
Old 07-26-2010
Extract lines between 2 strings add white space

I'm trying to extract all the lines between 2 strings (including the lines containing the strings)

To make the strings unique I need to include white space if possible. I'm not certain how to do that.


Code:
sed -n '/ [white_space_here] string1 [white_space_here] /,/string2/p' infile > outfile &

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find lines with space between strings

Hello all, I am having trouble with setting up a regular expression used with egrep. My script reads an input file a line at a time. I would like the egrep command to search for the following pattern: server name at the beginning of the line, then one or more spaces, and then a pound sign. ... (5 Replies)
Discussion started by: Galt
5 Replies

2. Shell Programming and Scripting

Remove white space at the beginning of lines

Hi! I store some data obtained with grep or awk in a file. The problem is that some lines have white space at the begining : line1 line2 line3 I use something like grep WORD INFILE >> OUTFILE awk >> OUTFILE I would love if it were possible to remove the white whitout parsing the... (4 Replies)
Discussion started by: tipi
4 Replies

3. Shell Programming and Scripting

is it hard to extract particular lines & strings from the files??

Hi Experts, I have lots of big size files. Below is the snapshot of a file. From the files i want extract informmation like belows. What could be command or script for that? DELETE RESP:940120105 CREATE RESP:0 GET RESP:0 File contains like below- ... ... <log... (8 Replies)
Discussion started by: thepurple
8 Replies

4. Shell Programming and Scripting

Add white space to the end of a line with sed

Im trying to add 5 blank spaces to the end of each line in a file in a sed script. I can figure out who o put the spaces pretty much anywhere else but at the end. thanks Karl (7 Replies)
Discussion started by: karlanderson
7 Replies

5. Shell Programming and Scripting

Removing empty lines(space) between two lines containing strings

Hi, Please provide shell script to Remove empty lines(space) between two lines containing strings in a file. Input File : A1/EXT "BAP_BSC6/07B/00" 844 090602 1605 RXOCF-465 PDTR11 1 SITE ON BATTERY A2/EXT... (3 Replies)
Discussion started by: sudhakaryadav
3 Replies

6. Shell Programming and Scripting

AWK: How to extract text lines between two strings

Hi. I have a text test1.txt file like:Receipt Line1 Line2 Line3 End Receipt Line4 Line5 Line6 Canceled Receipt Line7 Line8 Line9 End (9 Replies)
Discussion started by: TQ3
9 Replies

7. Shell Programming and Scripting

Extract strings from multiple lines into one file -

input file Desired csv output gc_type, date/time, milli secs af, Mar 17 13:09:04 2011, 144.596 af, Mar 20 00:37:37 2011, 144.242 af, ar 20 21:30:59 2011, 108.518 Hi All, Any help in acheiving the above would be appreciated. I would like to parse through lines within one file and... (5 Replies)
Discussion started by: satish.vampire
5 Replies

8. Shell Programming and Scripting

Extract strings from multiple lines into one csv file

Hi all, Please go through my requirement. I have a log file in the location /opt/WebSphere61/AppServer/profiles/EMQbatchprofile/logs/EMQbatch This file contains the follwing pattern data <af type="tenured" id="42" timestamp="May 14 13:44:13 2011" intervalms="955.624"> <minimum... (8 Replies)
Discussion started by: satish.vampire
8 Replies

9. Shell Programming and Scripting

Add strings to test lines

Hi all, i have a file that looks like this; 8120 ahdmesb:8001 8330 ahdmesb:8001 8888 vfnla88s-z2:8888 9060 ahdesb:80 9063 ahdesb:80 9070 nleaip-vip:9070 9090 nleaip-vip:9070 9123 nleaip-vip:9080 i want it to be displayed as: ahdmesb:8001 is listening on port 8120 ahdmesb:8001 is... (2 Replies)
Discussion started by: Eman_in_forum
2 Replies

10. Shell Programming and Scripting

Add white space

hi guys how can i add spacein file name with sed if strings have no space around dash input 19-20 ( 18-19 ) ABC-EFG output after add white space 19 - 20 (18 - 19 ) ABC - EFG thx in advance (2 Replies)
Discussion started by: mhs
2 Replies
fwcscmp(3)						     Library Functions Manual							fwcscmp(3)

NAME
fwcscmp - fuzzy comparison of two wide-character strings SYNOPSIS
#include <fstrcmp.h> #define FSTRCMP_IDENTICAL #define FSTRCMP_THRESHOLD #define FSTRCMP_ERROR double fwcscmp(const wchar_t *string1, const wchar_t *string2); DESCRIPTION
The fwcscmp() function compares the two wide-character strings, string1 and string2. RETURN VALUE
The fwcscmp function returns a floating point value between 0.0 and FSTRCMP_IDENTICAL. A value of 0.0 means the two wide-character strings are utterly un-alike. A value of FSTRCMP_IDENTICAL means the two wide-character strings are identical. A value of more than FSTR- CMP_THRESHOLD (it lies between 0.0 and FSTRCMP_IDENTICAL) would be considered "similar" by most people. A value of FSTRCMP_ERROR (always negative) indicates a malloc(3) failure. SEE ALSO
fstrcmp(3) fuzzy comparison of two strings fwcscmpi(3) fuzzy comparison of two wide-character strings wcscmp(3) compare two wide-character strings COPYRIGHT
fstrcmp version 0.4 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au> The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7. Copyright (C) 1988-2009 Free Software Foundation fwcscmp(3)
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy