proggybilly
Programmer
I have a script that pulls info from a file and populates it into a database. However one of these lines, can sometimes put too much into the field. For example, I could have lines that look like this, the result of doing a du -sh on a file: (not in the same file though)
The problem i am having is I need enough room in my field for 688M so I cannot change the field size. What is happening is my field ends up like this:
What I want to do is remove all characters following the 'M' or the 'G'.
I am relatively new to PERL so not sure what function to use or how to do it. Anyone able to lead me in the right direction?
Code:
688M /srv/[URL unfurl="true"]www/htdocs/mysite.tgz[/URL]
12G /srv/[URL unfurl="true"]www/htdocs/my2site.tgz[/URL]
The problem i am having is I need enough room in my field for 688M so I cannot change the field size. What is happening is my field ends up like this:
Code:
688M
12G /
What I want to do is remove all characters following the 'M' or the 'G'.
I am relatively new to PERL so not sure what function to use or how to do it. Anyone able to lead me in the right direction?