sunhux
asked on
Perl or Unix Shell script to replace 4th column value to the left of a specific text in a csv file
Refer to the attached sample file; my actual file has thousands of lines of the same
format.
I need a script urgently that would allow me to
a) search a specific (case-sensitive) text in the last column of the csv file (script is to
allow me to input the text as the 1st parameter)
b) then for the 4th column in the csv file, replace the value with another value
(this new value is to be taken as a parameter).
So, for example, if your script is called replvalue.pl or replvalue.sh,
then I just need to execute it as :
# replvalue.pl "CPUTotalLoad Repaired" 3.0
so the above wud change the last line of the csv to :
2898,29/4/2010 9:12:27 AM,664.8,3.0,,Medium,UNIX- HP,Globl Ops,29/4/2010 8:17:54 PM,665.4,29/4/2010 8:17:44 PM,incident,,UKOPPMB2.AG.U K UxsA2_CPUTotalLoad Repaired Critical
egcsv.txt
format.
I need a script urgently that would allow me to
a) search a specific (case-sensitive) text in the last column of the csv file (script is to
allow me to input the text as the 1st parameter)
b) then for the 4th column in the csv file, replace the value with another value
(this new value is to be taken as a parameter).
So, for example, if your script is called replvalue.pl or replvalue.sh,
then I just need to execute it as :
# replvalue.pl "CPUTotalLoad Repaired" 3.0
so the above wud change the last line of the csv to :
2898,29/4/2010 9:12:27 AM,664.8,3.0,,Medium,UNIX-
egcsv.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.