Hi,
I have a file with th elist of patches separated by comma, like below:
patch1, patch 2, patch 3................
t\The number of patches is not known as it changes every time.
I need assistance in writing a routine such as it will take patch1 as first variable and performs the installation, then reads the file again takes patch2 as value and perform installation.
I have a shell script which perform the installation but i pass one value at a time. i want to run it in a single shot.
Thanks for all th ehelp in advance.
Try:
( IFS=,
while read line
do
for i in $line
do
install "$i"
done
done
) < infile
thanks!!!!!
here's my sript:
#!/bin/bash
INPUT=/tmp/patch_list.txt
( IFS=,
while read PATCHES
do
for i in $PATCHES
do
echo $PATCHES
done
done
) < $INPUT
patch_list.txt has following values:
SW06859140F110.1039274,SW06859140F110.1039276,SW06859140F110.1039289
when i run the routine it removes the comma and gives all the patches mlike below:
SW06859140F110.1039274 SW06859140F110.1039276 SW06859140F110.1039289
what i am looking for is one value at a time, some thing like below:
SW06859140F110.1039274
SW06859140F110.1039276
SW06859140F110.1039289
thanks for all the help in advance.
awk -F, '{for(i=1;i<=NF;i++) a[++j]=$i;next;}END{for(i=1;i<=j;i++) print a;}' $INPUT | while read PATCHES
do
echo $PATCHES
done
Replace: echo $PATCHES
with echo "$i"