Friday, January 31, 2020

Multipurpose Line Reader

Hi again,

If you are working with large number of servers and services in linux this might be useful to you. Not only in System Administration but also  this simple few lines can be used in different kind of situations. In my case I am going to use this shell to retrieve names of multiple git repos and create new github repos them using HUB.


Let's Start!

First create a text file and include whatever you need to parse LINE BY LINE

ex:

sudo vim input.txt
THIS LINE 1
THIS LINE 2
THIS LINE 3

Then Save it!

And then Create the shell file

sudo vim line.sh


file=/path/to/text/file
while IFS= read  -r line || [ -n "$line" ] do
echo "$line"
done < "$file"

and then save it and make sure to set chmod as +x :-)

is that it? yes!

you can do lot of cool things from this simple code. Don't forget to mention them on the comment section

and also the next post will be about usage of this shell with HUB. Thanks!



No comments:

Post a Comment

Update openSSL to latest 1.1.1 version (1.1.1w)

  By the time(2024) one our system use this old OpenSSL version 1.1.1g and we are going to update it to latest version of 1.1.1 openSSL v...