Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Awk/sed command to extract the string between 2 patterns but having some particular value Post 303039106 by reldb on Monday 23rd of September 2019 05:17:21 AM
Old 09-23-2019
Awk/sed command to extract the string between 2 patterns but having some particular value

Hi -

i have one file with content as below.

Code:
***** BEGIN 123 *****
BASH is awesome
***** END *****
***** BEGIN 365 *****
KSH is awesome
***** END *****
***** BEGIN 157 *****
KSH is awesome
***** END *****
***** BEGIN 7123 *****
C is awesome
***** END *****

I am trying to find all the lines in between BEGIN and END but having KSH is awesome

I was using awk '/BEGIN/,/END/' MyFileName
but it is giving me all the content. How do i extract only below 2, kind of having clause between the 2 strings.

***** BEGIN 365 *****
KSH is awesome
***** END *****
***** BEGIN 157 *****
KSH is awesome
***** END *****

Pls suggest a way around
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To extract the string between two patterns

Sample input: Loading File System Networking in nature Closing the System now i need to extract the patterns between the words File and Closing: i.e. sample output: System Networking in Nature Thanks in advance !!!!!!!!!!!!!!!!! (6 Replies)
Discussion started by: aajan
6 Replies

2. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

3. Shell Programming and Scripting

deleting lines between patterns using sed or awk

hi, Here is excerpt from my xml file <!-- The custom module to do the authentication for LDAP --> </login-module> <login-module code="com.nlayers.seneca.security.LdapLogin" flag="sufficient"> <module-option... (1 Reply)
Discussion started by: sunrexstar
1 Replies

4. Shell Programming and Scripting

Use grep sed or awk to extract string from log file and put into CSV

I'd like to copy strings from a log file and put them into a CSV. The strings could be on different line numbers, depending on size of log. Example Log File: File = foo.bat Date = 11/11/11 User = Foo Bar Size = 1024 ... CSV should look like: "foo.bat","11/11/11","Foo Bar","1024" (7 Replies)
Discussion started by: chipperuga
7 Replies

5. Shell Programming and Scripting

Sed/awk print between different patterns the first occurrence

Thanks for the help yesterday. I have a little modification today, I am trying the following: i have a log file of a webbap which logs in the following pattern: 2011-08-14 21:10:04,535 blablabla ERROR Exception1 blablabla bla bla bla bla 2011-08-14... (2 Replies)
Discussion started by: ppolianidis
2 Replies

6. Shell Programming and Scripting

Patterns with egrep/sed/awk?

I have an array with characters, what I want is if there are other characters in the array which I am looking for than take action that is print BAD ARRAY. So far my code just finds characters but instead I want that it should look for other characters. echo "A B C D F" | egrep -o "D | F" O/P... (5 Replies)
Discussion started by: dixits
5 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

String search between patterns using sed

Hi, I am trying to find a way to get sed/awk/grep to help me find a string in a log file that exists between two datestamps and then print the preceding datestamp up to the next datestamp. Here is an example of my logfile: +++ 2013/03/28 17:01:37.085 SIGNALING HIGH ACTIVE Failure Response... (5 Replies)
Discussion started by: raytx
5 Replies

9. Shell Programming and Scripting

awk extract strings matching multiple patterns

Hi, I wasn't quite sure how to title this one! Here goes: I have some already partially parsed log files, which I now need to extract info from. Because of the way they are originally and the fact they have been partially processed already, I can't make any assumptions on the number of... (8 Replies)
Discussion started by: chrissycc
8 Replies

10. UNIX for Beginners Questions & Answers

Sed, awk or another bash command to modify string with the content of another file

Hello everybody, I would like modify some strings using sed or another command line with the content file. For example: - {fqdn: "server-01" , ip: "server-01"} - {fqdn: "server-02" , ip: "server-02"} - {fqdn: "server-03" , ip: "server-03"} - {fqdn: "server-04" , ip: "server-04"} My... (4 Replies)
Discussion started by: dco
4 Replies
AWESOME(1)																AWESOME(1)

NAME
awesome - awesome window manager SYNOPSIS
awesome [-v | --version] [-h | --help] [-c | --config FILE] [-k | --check] DESCRIPTION
awesome is a window manager for X. It manages windows in different layouts, like floating or tiled. Any layout can be applied dynamically, optimizing the environment for the application in use and the task currently being performed. In a tiled layout, windows are managed in a master and stacking area. The master area contains the windows which currently need the most attention, whereas the stacking area contains all other windows. In a floating layout windows can be resized and moved freely. Dialog windows are always managed as floating, regardless of the layout currently applied. The spiral and dwindle layouts are special cases of the tiled layout where the stacking area is arranged in a spiral for the former or as a rectangular fractal for the later. Windows are grouped by tags in awesome. Each window can be tagged with one or more tags. Selecting certain tags displays all windows with these tags. awesome can contain small wiboxes which can display anything you want: all available tags, the current layout, the title of the visible windows, text, etc. OPTIONS
-v, --version Print version information to standard output, then exit. -h, --help Print help information, then exit. -c, --config FILE Use an alternate configuration file instead of $XDG_CONFIG_HOME/awesome/rc.lua. -k, --check Check configuration file syntax. DEFAULT MOUSE BINDINGS
Navigation Button1 on tag name View tag. Button4, Button5 on tag name Switch to previous or next tag. Button4, Button5 on root window Switch to previous or next tag. Button1, Button3, Button4, Button5 on layout symbol Switch to previous or next layout. Layout modification Mod4 + Button1 on tag name Tag current client with this tag only. Mod4 + Button3 on tag name Toggle this tag for client. Button3 on tag name Add this tag to current view. Mod4 + Button1 on client window Move window. Mod4 + Button3 on client window Resize window. DEFAULT KEY BINDINGS
Window manager control Mod4 + Control + r Restart awesome. Mod4 + Shift + q Quit awesome. Mod4 + r Run prompt. Mod4 + x Run Lua code prompt. Mod4 + Return Spawn terminal emulator. Mod4 + w Open main menu. Clients Mod4 + Shift + r Redraw the focused window. Mod4 + m Maximize client. Mod4 + n Minimize client. Mod4 + Control + n Restore client. Mod4 + f Set client fullscreen. Mod4 + Shift + c Kill focused client. Mod4 + t Set client on-top. Navigation Mod4 + j Focus next client. Mod4 + k Focus previous client. Mod4 + u Focus first urgent client. Mod4 + Left View previous tag. Mod4 + Right View next tag. Mod4 + 1-9 Switch to tag 1-9. Mod4 + Control + j Focus next screen. Mod4 + Control + k Focus previous screen. Mod4 + Escape Focus previously selected tag set. Layout modification Mod4 + Shift + j Switch client with next client. Mod4 + Shift + k Switch client with previous client. Mod4 + o Send client to next screen. Mod4 + h Decrease master width factor by 5%. Mod4 + l Increase master width factor by 5%. Mod4 + Shift + h Increase number of master windows by 1. Mod4 + Shift + l Decrease number of master windows by 1. Mod4 + Control + h Increase number of columns for non-master windows by 1. Mod4 + Control + l Decrease number of columns for non-master windows by 1. Mod4 + space Switch to next layout. Mod4 + Shift + space Switch to previous layout. Mod4 + Control + space Toggle client floating status. Mod4 + Control + Return Swap focused client with master. Mod4 + Control + 1-9 Toggle tag view. Mod4 + Shift + 1-9 Tag client with tag. Mod4 + Shift + Control + 1-9 Toggle tag on client. Mod4 + Shift + F1-9 Tag marked clients with tag. CUSTOMIZATION
awesome is customized by creating a custom $XDG_CONFIG_HOME/awesome/rc.lua file. SIGNALS
awesome can be restarted by sending it a SIGHUP. SEE ALSO
awesomerc(5) awesome-client(1) BUGS
Of course there's no bug in awesome. But there may be unexpected behaviors. AUTHORS
Julien Danjou <julien@danjou.info[1]> and others. WWW
http://awesome.naquadah.org NOTES
1. julien@danjou.info mailto:julien@danjou.info 07/16/2012 AWESOME(1)
All times are GMT -4. The time now is 03:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy