AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool.

learn more… | top users | synonyms

7
votes
1answer
232 views

Bash script - automate an upload image + description process on a server

I was tasked at work to improve a system where through a web interface a client, which eventually became us, uploads a bunch of images with descriptions (latter coming from csv files), the images are ...
7
votes
3answers
2k views

Extracting data from text file in bash using awk, grep, head and tail

I've been writing bash script on and off, with pretty good results in terms of getting the job done. However, I'm worried that my script might be very ugly, as I am a beginner. I'm looking for advice ...
5
votes
1answer
55 views

Calculating percentages in arbitrary number of columns

Given this sample input: ...
4
votes
2answers
81 views

Filter shell script to find lines that contain all specified patterns

I wrote a script that does the following: Run another script on the system Filter the output to find lines that contain ALL of the given patterns Pipe the output to a second script on the system I ...
4
votes
1answer
162 views

Directory's disk usage list

For my classes, I had to finish this task: Directory's disk usage list For indicated directory print a list of files and subdirectories in descending order according to their total disk ...
3
votes
2answers
265 views

Checking percentage of free memory using top and awk

The following Awk code was created in order to verify if free memory from the top command is less than 20% of the total. I've noticed that I actually do not need the ...
3
votes
1answer
46 views

Extracting performance statistics from FTP session transcript

I've borrowed and written the following code to output the disconnect time. All works well but I'm curious as to how I could tighten/ shorten the code. If anyone feels like having some fun then I'd ...
3
votes
2answers
71 views

Shell script to count chess game outcomes

I came across this blog post by Adam Drake from around a year ago which is now making the rounds again. I made some improvements to his code, but wish to see if there are additional tweaks that could ...
3
votes
1answer
157 views

Analyse an Nginx access log with awk and produce a report

I'm looking for your opinions on anything that I am doing wrong in the application below, such as best practices, glaringly horrible errors or even just your own personal opinion. Task: Grab an Nginx ...
3
votes
2answers
131 views

Removing NULL / empty fields

just wanted to check with you could this be done better: ...
3
votes
2answers
114 views

Bash log monitoring

I've made a Bash script to monitor some server log files for certain data and my method probably isn't the most efficient. One section specifically bugs me is that I have to write a newline to the ...
3
votes
1answer
61 views

Input Columns with Awk

I wrote a small script to manipulate fields of a file based on the input of a user. Is there something I could've done better, or perhaps a better refactor? I do know however that I need a way to ...
1
vote
0answers
94 views

Linking input/output states and conditions in an input file

Consider the following CSV file: A; B; ; B; ; A; C; ; E F; D; ; E; E; C; ; The fields: $1: the jname. A unique id of the entry. $2: a " "(space)-separated list ...