I have written a script using sed to edit. Unfortunately the sed version is old and i have to edit file to another one, then copy over it. So i thought id give perl ago. I played around with pie but cannot work out how to pass variables to it and use line numbers.
A basic version of my Script:
#!/usr/bin/ksh
test1()
{
eval sed -e $1 testfile > testfile2
}
test1 "'1s/.*/test /'"
#test1 "'1s/.*/ '$(tput smso)'broken'$(tput rmso)' /'"
So i pass a string to another function, which is read by SED. I have to use line numbers due to duplicate text entries in the text file im editing.
The second test (commented out) does a reverse video to highlight that text.
Can anyone give me pointers as to how i can write the above in perl.
A basic version of my Script:
#!/usr/bin/ksh
test1()
{
eval sed -e $1 testfile > testfile2
}
test1 "'1s/.*/test /'"
#test1 "'1s/.*/ '$(tput smso)'broken'$(tput rmso)' /'"
So i pass a string to another function, which is read by SED. I have to use line numbers due to duplicate text entries in the text file im editing.
The second test (commented out) does a reverse video to highlight that text.
Can anyone give me pointers as to how i can write the above in perl.