RenMcCourtey has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I have a piece of bash code I'm using to list all running db instances on logon to server. It runs quite slowly, annoyingly delaying logon. I need to grep uncommented lines, get first column and alphabetically sort it, this is core of the command:
grep '^[A-Z]' /var/opt/oracle/oratab | awk -F: '{print $1}' | sortI was thinking about using perl oneliner but I am not really good with that and I am not even sure if it will run faster. Anyone would be willing to show me how? Is it even a good idea?
/edit: I should show what I started with:
perl -lane 'print if /^[A-Z]/;' /var/opt/oracle/oratabThis is to grep but now I need to add next step (awk) and I'm not sure what's the right syntax.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parse a text file with oneliner
by haukex (Archbishop) on Aug 28, 2017 at 09:55 UTC | |
by RenMcCourtey (Acolyte) on Aug 28, 2017 at 10:08 UTC | |
by haukex (Archbishop) on Aug 28, 2017 at 10:20 UTC | |
by RenMcCourtey (Acolyte) on Aug 28, 2017 at 12:07 UTC | |
by RMGir (Prior) on Aug 28, 2017 at 14:00 UTC |