Sponsored Content
Top Forums Shell Programming and Scripting Script to print first and last line have two pattern Post 302370184 by nitinkgoud on Tuesday 10th of November 2009 05:58:01 PM
Old 11-10-2009
Script to print first and last line have two pattern

Hello Guys,
I have file like
aaa
bbb
Line 1
cc
dd
Ser Nu 11223
ee
ff
Line 2
hh
hh
Ser Nu 44556
ii
jj

I need to match line starting with Line and Ser and only display them like

Line 1 Ser Nu 11223 | Line 2 Ser Nu 44556

The number of lines can be multiple Line 1 Line 2 Line 3 Line 4 ........Line 1000

---------- Post updated at 05:58 PM ---------- Previous update was at 04:44 PM ----------

sed -n '/Line/,/Ser/p'
this prints all the lines between the Line and Ser.
A small tweek is needed.........any takers.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print the line within the search pattern

Hi Guys, I had file as typedef struct { char TrailerType1; char TrailerTxt1; }Trailer; typedef struct { char PfigMoneyType; char PfigMoneyvalue; }PfigMoney; i need to print the lines within the search pattern. if i give the search pattern as... (3 Replies)
Discussion started by: manosubsulo
3 Replies

2. Shell Programming and Scripting

match a pattern and print the line once

Hi, I have a xml file <cisco:name> <cisco:mdNm>Cisco Device 7500 A Series</cisco:mdNm> <cisco:meNm>10.1.100.19</cisco:meNm> <cisco:ehNm>/shelf=1</cisco:ehNm> <cisco:subname> <cisco:meNm>10.1.100.19</cisco:meNm> <cisco:sptp>Cisco PortA Series</cisco:sptp> ... (11 Replies)
Discussion started by: bhagirathi
11 Replies

3. Programming

Print specific pattern line in c++

Input file: @HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC +HWI-BRUNOP1_header_1 TNTTJTTTETceJSP__VRJea`_NfcefbWe Desired output file: >HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC >HWI-BRUNOP1_header_2... (10 Replies)
Discussion started by: cpp_beginner
10 Replies

4. Shell Programming and Scripting

Print Line if next line Match a pattern

Hi All, Does anyone know how to print 1H1A....... in peal script print line ^1H1A....... if next line equal 5R0RECEIPT.... Thank for help:D Cat st.txt 1H1A-IN-11-5410-0009420|1010047766|dsds|1|N|IN|IN|000000|1||N|<<<line match 5R0RECEIPT| 5R0RECEIPT|... (2 Replies)
Discussion started by: kittiwas
2 Replies

5. Shell Programming and Scripting

Print between multi line pattern

Hi, I have a file with text like this .SET WIDTH 10000 .SET MAXERROR 1 insert into new_db SELECT * FROM some_db ; +---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+- .SET WIDTH 10000... (3 Replies)
Discussion started by: sol_nov
3 Replies

6. Shell Programming and Scripting

Script to compare pattern and print a different pattern in each line

Hi, I am writing a shell script to parse some files, and gather data. The data in the files is displayed as below. .......xyz: abz: ......qrt: .... .......xyz: abz: ......qrt: ... I have tried using awk and cut, but the position of these values keep changing, so I wasn't able to get... (2 Replies)
Discussion started by: Serena
2 Replies

7. Shell Programming and Scripting

Print only next pattern in a line after a pattern match

I have 2013-06-11 23:55:14 1Umexd-0004cm-IG <= user@domain.com I need sed/awk operation on this, so that it should print the very next pattern only after the the pattern mach <= ie only print user@domain.com (7 Replies)
Discussion started by: anil510
7 Replies

8. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

9. Shell Programming and Scripting

How to print previous line of multiple pattern matched line?

Hello, I have below format log file, Comparing csv_converted_files/2201/9747.1012H67126.5077292103609547345.csv and csv_converted_files/22019/97447.1012H67126.5077292103609547345.csv Comparing csv_converted_files/2559/9447.1012H67126.5077292103609547345.csv and... (6 Replies)
Discussion started by: arvindshukla81
6 Replies

10. UNIX for Beginners Questions & Answers

Reading a file line by line and print required lines based on pattern

Hi All, i want to write a shell script read below file line by line and want to exclude the lines which contains empty value for MOUNTPOINT field. i am using centos 7 Operating system. want to read below file. # cat /tmp/d5 NAME="/dev/sda" TYPE="disk" SIZE="60G" OWNER="root"... (4 Replies)
Discussion started by: balu1234
4 Replies
ttk::label(3tk) 						 Tk Themed Widget						   ttk::label(3tk)

__________________________________________________________________________________________________________________________________________________

NAME
ttk::label - Display a text string and/or image SYNOPSIS
ttk::label pathName ?options? _________________________________________________________________ DESCRIPTION
A ttk::label widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. STANDARD OPTIONS
-class -compound -cursor -image -style -takefocus -text -textvariable -underline -width See the ttk_widget manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS Command-Line Name:-anchor Database Name: anchor Database Class: Anchor Specifies how the information in the widget is positioned relative to the inner margins. Legal values are n, ne, e, se, s, sw, w, nw, and center. See also -justify. Command-Line Name:-background Database Name: frameColor Database Class: FrameColor The widget's background color. If unspecified, the theme default is used. Command-Line Name:-font Database Name: font Database Class: Font Font to use for label text. Command-Line Name:-foreground Database Name: textColor Database Class: TextColor The widget's foreground color. If unspecified, the theme default is used. Command-Line Name:-justify Database Name: justify Database Class: Justify If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of left, center, or right. See also -anchor. Command-Line Name:-padding Database Name: padding Database Class: Padding Specifies the amount of extra space to allocate for the widget. The padding is a list of up to four length specifications left top right bottom. If fewer than four elements are specified, bottom defaults to top, right defaults to left, and top defaults to left. Command-Line Name:-relief Database Name: relief Database Class: Relief Specifies the 3-D effect desired for the widget border. Valid values are flat, groove, raised, ridge, solid, and sunken. Command-Line Name:-text Database Name: text Database Class: Text Specifies a text string to be displayed inside the widget (unless overridden by -textvariable). Command-Line Name:-wraplength Database Name: wrapLength Database Class: WrapLength Specifies the maximum line length (in pixels). If this option is less than or equal to zero, then automatic wrapping is not per- formed; otherwise the text is split into lines such that no line is longer than the specified value. WIDGET COMMAND
Supports the standard widget commands configure, cget, identify, instate, and state; see ttk::widget(3tk). SEE ALSO
ttk::widget(3tk), label(3tk) Tk 8.5 ttk::label(3tk)
All times are GMT -4. The time now is 04:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy