Link to home
Start Free TrialLog in
Avatar of xbox360dp
xbox360dp

asked on

Perl Script - Remove column of data based on column value

Gurus,

I need to remove a column of data based on the column value.

Example
File1.txt - Before
Data1|00|123
Data2|11|456
Data3|10|789

Example
File1.txt - After
Data1||123
Data2|11|456
Data3|10|789

Any help would be great.
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

remove.pl file1.txt

while (<>) {
	@s = split /\|/,;
	$s[1] =~ s/00//g;
	print join('|',$s[0],$s[1],$s[2]);
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of wilcoxon
wilcoxon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial