AWK is an interpreted programming language designed for text processing and typically used as a data extraction and reporting tool.
3
votes
2answers
30 views
Advanced CSV-to-SQLite converter
I just wrote an advanced CSV parser that translates CSV to SQL(SQLite Compatible) statements, which are then inserted into the database. It translates variable names in the CSV to values defined in ...
1
vote
1answer
15 views
Print first element of the last line of files when the second element does not match a pattern
I am relatively new to Bash, regular expression and stuff.
In a directory, I need to read the last line of all the files that contain the word "fitness", and list (on one line and separated with ...
3
votes
2answers
87 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 ...
6
votes
1answer
64 views
3
votes
2answers
500 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
454 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 ...
7
votes
3answers
4k 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 ...
4
votes
2answers
83 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 ...
3
votes
1answer
47 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 ...
7
votes
1answer
322 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 ...
3
votes
2answers
151 views
3
votes
1answer
65 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 ...
3
votes
2answers
133 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 ...
4
votes
1answer
165 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 ...
1
vote
0answers
95 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 ...