skip to Main Content

Parsing an array with emty element – Ubuntu

Hello I am trying to parse a file into an array which contains empty elements Sample file (test) test11|test12|test13|test14 test21||test23|test24 the following funtion just print the array elements test_func() { local param=($@) echo "1: ${param[1]}, 2: ${param[2]}, 3: ${param[3]}, 4:…

VIEW QUESTION

How can I change my program to let it display the output – Ubuntu

I'm trying to print out the happiest countries in the world for 2022, by receiving the data from https://en.wikipedia.org/wiki/World_Happiness_Report?action=raw). and then editing displaying the first 5 countries. Here is my code: #!/bin/bash content=$(curl -s "https://en.wikipedia.org/wiki/World_Happiness_Report?action=raw") lines=$(echo "$content" | grep '^|'…

VIEW QUESTION

Is it possible using a Linux command or shell script to remove unwanted rows in a file based on certain condition? – Ubuntu

I have a file that has ~12300000 rows of type <timestamp, reading> - 1674587549.228 29214 1674587549.226 29384 1674587549.226 27813 1674587549.226 28403 1674587549.228 28445 ... 1674587948.998 121 1674587948.998 126 1674587948.999 119 1674587949.000 126 1674587948.996 156 1674587948.997 152 1674587948.998 156 1674588149.225 316…

VIEW QUESTION
Back To Top
Search