Your use of AWK
How useful is AWK for day-to-day practice? Is it useful to learn it? How often do you use it?
|
Some people just use it for one-liners to eg extract one or more fields separated by random amts of space from a record.
Others write entire programs in it. This may help http://www.grymoire.com/Unix/Awk.html |
Thank you.
|
I've never used it in over a decade of using Linux. If you have a GUI, then the old command-line tools seem rather redundant, unless you already know them and are used to them.
|
It is useful in many cases, especially complex text manipulation. However, bash is more useful overall. I use awk in about 30% of my scripts.
|
I'll use awk if the problem needs less than about 50 lines to implement. If it looks like it will take more then I will use Perl, as it is faster than awk, and MUCH more flexible, with better diagnostics.
|
I use it for numerous one-time data processing projects. For example when I get a CSV file and I must process it on one or another way to include in a report.
For projects with a longer life time I use it often to transform CSV data or database output into something else. That something else is often SQL statements to get it onto a different database. Examples include radio program schedules from one format to another format. Database output to Google KML format. Database output to Latex. I don't know if Perl would have been better for those purposes. I never learned it because of its incomprehensible syntax. jlinkels |
:p
I learned perl first, then some years later awk. Now-adays I would use awk every day, (new) perl maybe once a month if something big comes along. Bash a distant third because I keep having to look things up due to irregular usage. |
Thank you.
|
I decided to learn awk before sed because it can do everything sed can do. Some things can be done more elegantly by sed but awk can do them. And, having already learned C, awk was easier.
Since the I have written some 1000+ line awk scripts -- for example for transforming CSV and LDIF files. Now I'm comfortable with sed too and use whichever is best suited to the task. Perl may be great but I cannot generate any enthusiasm for learning it. Reportedly it's easy to learn if you know C, regular expressions and shell script but first attempts were much more frustrating than first awk attempts. And it doesn't look nice :eek: |
I learnt awk because I raised a question about data that could be defined by a delimiter and was told this is the tool :)
As with others, the right tool for the job is best, but I would predominantly use awk for quick and short program manipulation and then switch to Ruby (catkin you might give this a try) for larger tasks that require more finesse :) |
All times are GMT -5. The time now is 03:08 PM. |