Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-31-2016, 09:08 AM   #16
Registered: Dec 2011
Location: Simplicity
Posts: 647

Rep: Reputation: 298Reputation: 298Reputation: 298

\+ is not defined in BRE.
Strict BRE needs [0-9][0-9]* or [0-9]\{1,\} instead of [0-9]\+
Old 02-05-2016, 10:40 AM   #17
LQ Newbie
Registered: Oct 2012
Location: Seattle, WA
Distribution: RHEL
Posts: 1

Rep: Reputation: Disabled
Taking the assumption that you want the first field and the last 3 fields with some static text in between, you can use awk to slice in from the end and then strip off the double quotes. $NF is the number of fields, which in awk is equivalent to the last field.

awk '{print $1" example "$(NF - 2)" "$(NF - 1)" "$(NF)}' example.txt | sed 's/\"//g'
10 "Stop abcdee fghi jk lmnz SS -c -i567 -i8a9b"
20 "Stop pqrstu vwxyz SS -c -g123 -g456"
10 example -c -i567 -i8a9b
20 example -c -g123 -g456


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
cat|grep|awk pudhiyavan Programming 6 07-14-2008 01:56 AM
cat and grep dipuasks Linux - General 11 04-21-2008 03:39 AM
cat to grep to textfile? jabfinger Linux - General 3 09-05-2006 03:25 PM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
Question About Cat And Grep George2 Linux - Software 10 03-09-2006 03:33 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration