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 Stream merge step by step in the REXX programming language
You may also check:How to resolve the algorithm Roman numerals/Encode step by step in the Ela programming language
You may also check:How to resolve the algorithm Averages/Arithmetic mean step by step in the Astro programming language
You may also check:How to resolve the algorithm Currying step by step in the Lua programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Verbexx programming language