All for Joomla All for Webmasters

Each Row & Each Column of file into a Variable X and Y


If you have a file with two columns

File.txt

Abc 123
Bhcs 27384
Bcddd 22421
Axde 234

And you want to each value from each row each colum into a variable X and Y. For example:
X=Abc Y=123 and use those values in some function like
Add = $X , $Y.

So for each x value and y value , you need to use these values for the function and then go to next value of x and y.

Question:-

I am able to use awk to get column 1 and 2, but not able to use those values as $X and $Y for each row and each coulmn transaction.

Answer:-

#! /bin/bash
cat “File.txt” | while read a b
do
echo $a
done


Like it? Share with your friends!

0
, 0 points

Each Row & Each Column of file into a Variable X and Y

log in

Become a part of our community!

reset password

Back to
log in
Choose A Format
Personality quiz
Trivia quiz
Poll
Story
List
Meme
Video
Audio
Image