Is learning bash scripting along with sed and awk still needed?
-
Agreed that sed/awk/Perl and bash scripting were used a lot earlier, but in today's times when we have Python and Ruby available, does it help to learn bash/sed/awk etc? Do recruiters give any importance to these tools?
-
Answer:
Is it still "needed"? No, depending on the role you are seeking it may not be needed at all. But is it useful? yes. These are tools that are on any Unix, and Ruby or Python may not be. Knowing how to do things in the shell is very helpful and it also shows that you are good at picking things up. Never stop learning. Thanks for the A2A
Larry Pieniazek at Quora Visit the source
Other answers
Yes. The more you learn Bash scripting (and the command line tools at your disposal), the less you use sed and awk and other scripting languages simply because you do a lot of your daily scripting needs a lot faster. Bash is more like a glue to connect the different command line tools available together to perform the task. So you end up mostly re-using others' code rather than solving the same problems again. Here's an example where I think I saved a lot of coding by doing it with a bash script: https://gist.github.com/Makistos/7154021 I mix git, uniq, sort, find (which I use a lot in my scripts), grep and sed to do something that would be quit complex otherwise. I would probably need to create some sort of data structure and associated handling and the code would be several times longer. Plus I'm using well tested tools which I don't need to debug and test.
Marko Poutiainen
Whenever I need to quickly parse columnar data, I reach for awk. It is more intuitive and much faster than most of the alternatives. I've had non-contrived examples where processing columnar data from a web log, into buckets and then displaying the frequency count was 17 times faster in awk than the equivalent Perl script. Awk is useful for tcpdump data, web processing data, find output data, or any other data where you want to count the occurrences of something. Let's say you want to display the count of the number of occurrences of the keywords in column 5 of some file: awk '{col[$5]++;} END {for (c in col) {print c, col[c]}}' $file | sort -n -k2,2 That's all there is too it, and it's blazing fast. With a little bit more logic you can do bucket histograms, calculate standard deviation or variance, etc. I use it as a quick method combined with tcpdump to see the top talkers of network traffic to a host. for sed: it's very powerful and most people don't use the full extent of its capabilities, but it remains the goto cool for doing a quick substitution of phrase X with phrase Y anywhere in a file. I could live without sed, but living without awk would be very sad.
Doug Hughes
#. It totally depends on your job, if you learn these or not. #. Personally, i would recommend you to learn these because someday you will need it, for sure. #. Bash is nearest (after C) language to *.nix. Its really powerful. Sed/awk & other tools gives you power with flexibility. #. It takes years to master bash, if you're in that league then you are rare and what is rare, is also expensive. #. In this era of cloud computing, automation plays a vital role. So embedding bash with chef or puppet, give you a cutting edge. So, it's not wise to ignore it.
Gaurav Rajput
According your description you are trying to compare bash,awk and sed with python and ruby. In that perspective you need to realize that most of the scripts that are currently distributed by any major Linux distribution were developed in bash, sh , awk, and perl. So if you need to troubleshoot, modify, or do new scripts that maintain the standard you need to know them.
Rodrigo Castro
Yes, you do. Here's why/how. Recently, I had to extract a list of servers from a command line output provided to me. The server names were duplicated so I had to be careful. Additionally, I had to remove unwanted lines and characters. With a bash script, it could be done in a jiffy.
Pritesh Ugrankar
Don't learn bash scripting. Learn unix shell scripting. Unix shell scripting will be your eternal friend: on any unix machine ever (including your mobile phone), you will be able to perform complex tasks in a one-liner with minimal mental effort and without needing to start a dedicated interpreter. If you befriend unix shell scripting, you will be comfortable doing nearly all tasks from the terminal; you will have no problem quickly performing mass-renames or generating and manipulating CSVs or building notification systems or monitoring systems in seconds; you can prototype large chunks of what most people would do in twenty lines of python, using a single line of shell. Bash, on the other hand, will allow you to do these things on linux, sometimes, depending on what the default shell was set to. You will have a hell of a time trying to do things you normally could as soon as you start using a stock debian-based distro (since most of them default to dash, not bash). You'll be in pain if you ever need to use a BSD or solaris box, or work from OSX, because bashisms won't port to csh. (On a tangential note, screw recruiters. Doing what you think recruiters want will just put you in the same box as all the other people who have the same misconceptions about recruiters. Develop real skills that are truly useful and the recruiters will be happy to help whichever real developers you have befriended who want you to be hired on to work with them.)
John Ohno
Each has its own significant advantages and disadvantages. when sed makes you sad, use awk. when awk looks awkward, use perl. when perl is terse to read, try C. So moral of the story is, the more you know, the more you are equipped with current technologies to play with your doubts/data and hence you can play with them as per your choice (in terms of execution speed, utilization etc.)
Anurag Kulshreshtha
May not be required if you are proficient with one of perl, python, ruby or any other scripting language.
Anand Bhat
Related Q & A:
- How to call a function with parameter in a bash script?Best solution by tldp.org
- How to add two variable in bash?Best solution by Stack Overflow
- How to count the number of lines in a file using Bash?Best solution by Stack Overflow
- What are the test automation tools that use perl as the scripting language??Best solution by Yahoo! Answers
- Who is playing at the B96 Summer Bash?Best solution by b96.cbslocal.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.