LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-15-2012, 02:49 AM   #16
sunilsagar
LQ Newbie
 
Registered: Jul 2011
Posts: 28

Original Poster
Rep: Reputation: Disabled

Thanks a lot guys, it worked .. thanks so much ..
 
Old 02-15-2012, 08:33 AM   #17
Reuti
Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 970

Rep: Reputation: 184Reputation: 184
@grail: did you use \0 by intention? It will put a null byte into the output, which is not printed but can be checked with the cat -A you mentioned.
 
Old 02-15-2012, 09:24 AM   #18
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Mint
Posts: 5,403

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
@reuti - the trinery in awk (?:) does not perform as expected if you use "" so the null gives you what we are after. Happy to know a different option
 
Old 02-15-2012, 09:32 AM   #19
Reuti
Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 11.4
Posts: 970

Rep: Reputation: 184Reputation: 184
Thx, but I’m still puzzled:
Code:
$ cat file
ADMU0508I: The Application Server "Portal" is STARTED
ADMU0508I: The Web server "HTTPServer" is STOPPED
ADMU0508I: The Node Agent "nodeagent" is STARTED
ADMU0508I: The Application Server "Server2" is
STARTED
ADMU0508I: The Application Server "Server3" is STOPPED
$ awk 'ORS=/ED$/?"\n":" \0"' file | cat -A
ADMU0508I: The Application Server "Portal" is STARTED$
ADMU0508I: The Web server "HTTPServer" is STOPPED$
ADMU0508I: The Node Agent "nodeagent" is STARTED$
ADMU0508I: The Application Server "Server2" is ^@STARTED$
ADMU0508I: The Application Server "Server3" is STOPPED$
$ awk 'ORS=/ED$/?"\n":" "' file | cat -A
ADMU0508I: The Application Server "Portal" is STARTED$
ADMU0508I: The Web server "HTTPServer" is STOPPED$
ADMU0508I: The Node Agent "nodeagent" is STARTED$
ADMU0508I: The Application Server "Server2" is STARTED$
ADMU0508I: The Application Server "Server3" is STOPPED$
There is a ^@ for me in the output. What should the \0 do?
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Find text in a line, Replace line Cpare AIX 3 04-01-2011 11:33 AM
Help scripting to find line and print previous line to out jamieofansa Programming 4 05-21-2010 01:30 PM
Copy text from the command line fos Linux - Newbie 15 04-25-2009 06:41 AM
Attempting to append a line of text to the end of the previous line market_garden Linux - General 4 12-11-2008 11:37 AM
Copy text from command line Duukkis Linux - General 8 08-25-2003 01:29 PM


All times are GMT -5. The time now is 04:31 AM.

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