Recently I taught a 10-hour Linux webinar (basically digested first half of RHCSA) and as I researched some additional books I found cut command which is very useful.
What cut does is selects only specified fields from text file where you tell it what the delimiter is.
Example:
cut -f 1 -d : /etc/passwd
This selects 1st field in file /etc/passwd (user list) using : as delimiter and outputs it.
Results:
root
bin
daemon
user
alice
Our website is a mess as the Italians who can only copy paste and make stuff shiny but cannot code used some godawful visual composer on the wordpress and every page is full of UBB-like code with brackets on top of HTML. I wanted to find only list of country names in code containing 90.000 characters, so I wrote a bash script to find which columns delimited by = contain countries and then only output those fields to new file which is only 3000 characters long and has fields neatly arranged in lines, so I can just clear the bad text using dd or visual line in vi.
Then I can plug the country list in google translate and write a sed or awk script that will instareplace country names without me manually scrubbing through 90.000 character mess of the page code.
What cut does is selects only specified fields from text file where you tell it what the delimiter is.
Example:
cut -f 1 -d : /etc/passwd
This selects 1st field in file /etc/passwd (user list) using : as delimiter and outputs it.
Results:
root
bin
daemon
user
alice
Our website is a mess as the Italians who can only copy paste and make stuff shiny but cannot code used some godawful visual composer on the wordpress and every page is full of UBB-like code with brackets on top of HTML. I wanted to find only list of country names in code containing 90.000 characters, so I wrote a bash script to find which columns delimited by = contain countries and then only output those fields to new file which is only 3000 characters long and has fields neatly arranged in lines, so I can just clear the bad text using dd or visual line in vi.
Then I can plug the country list in google translate and write a sed or awk script that will instareplace country names without me manually scrubbing through 90.000 character mess of the page code.
Comment