|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I want to view a file ignoring mutilple comment line (/*....*/). Please help me on this.
Advance thanks. |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
In what language, and why have you posted in the Red Hat forum?
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Actually I want to see configuration file in Linux and I want to view the content which is not commented. I have tried below command line, but its omitting only the /* */ character not the block which is occupy by /*..*/ Ex: Code:
cat named.conf | egrep -v "^[[:blank:]]*($|#|//|/\*| \*|\*/)" Please help me on this.. Thank you.
Last edited by Scott; 01-20-2013 at 06:45 AM.. Reason: Code tags, please... |
|
#4
|
||||
|
||||
|
Try: Code:
perl -p0e 's:/\*.*?\*/::sg' named.conf |
| The Following User Says Thank You to elixir_sinari For This Useful Post: | ||
Pradipta Kumar (01-21-2013) | ||
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Code:
awk 'BEGIN {f=0;}{for(i=1;i<=NF;i++){ if($i=="/*") f=1; if($i=="*/") f=0;
if(f==0&&!($i=="/*"||$i=="*/")) {
$i=(i==NF)?$i RS:$i" "; printf "%s", $i ;
}}
}' named.conf |
| The Following User Says Thank You to Yoda For This Useful Post: | ||
Pradipta Kumar (01-21-2013) | ||
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Thank you All,,
Both command are working... Thank you very much ![]() |
| Sponsored Links | ||
|
![]() |
| Tags |
| red hat, unix |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to filter out data file...? | nex_asp | Shell Programming and Scripting | 5 | 12-09-2012 04:36 AM |
| Filter a .kml file (xml) with data set from text file | pcoj33 | Shell Programming and Scripting | 5 | 10-19-2011 01:28 PM |
| To filter a log file | dattatraya | Shell Programming and Scripting | 1 | 09-08-2008 10:51 PM |
| File filter | Dastard | Shell Programming and Scripting | 3 | 09-06-2007 01:50 PM |
| filter out certain column from a file | CamTu | Shell Programming and Scripting | 4 | 04-04-2005 06:24 PM |
|
|