9

Shell script to read a file and store in variables

view full story
linux-howto

http://www.unix.com – I have a input file like this. Sample.txt Code: 30    | TXDatacenter | TXBackupDC 10    | UKDatacenter | UKBackupDC 0      | NLDatacenter | NLBackupDC ...... ...... ...... I need to get these values in different variables like this. Code: Load1=30 PriCenter1=TXDatacenter BkpCenter1=TXBackupDC Load2=10 PriCenter2=UKDatacenter BklCenter2=UKBackupDC .... ... Basically, I am looking to separate the contents of the file based on words. But i want to store the values in to variables based on its line number. (i.e Load1, 2,3 & its corresponding P (HowTos)