How to resolve the algorithm Kernighans large earthquake problem step by step in the Bash programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Kernighans large earthquake problem step by step in the Bash programming language

Table of Contents

Problem Statement

Brian Kernighan, in a lecture at the University of Nottingham, described a problem on which this task is based. You are given a a data file of thousands of lines; each of three whitespace separated fields: a date, a one word name and the magnitude of the event. Example lines from the file would be lines like:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Kernighans large earthquake problem step by step in the Bash programming language

Source code in the bash programming language

#!/bin/bash
while read line 
do
    [[ ${line##* } =~ ^([7-9]|6\.0*[1-9]).*$ ]] && echo "$line"
done < data.txt


  

You may also check:How to resolve the algorithm URL encoding step by step in the Bash programming language
You may also check:How to resolve the algorithm Palindrome detection step by step in the Bash programming language
You may also check:How to resolve the algorithm Bitmap/Bresenham's line algorithm step by step in the bash programming language
You may also check:How to resolve the algorithm Sorting algorithms/Sleep sort step by step in the Bash programming language
You may also check:How to resolve the algorithm Sierpinski triangle step by step in the Bash programming language