how to shift the top element from array based on a regular expression using perl? Also these are datarecords, meaning I have the input record separator ($/) set to
$/=’#’;
for example, the following text file contains this data record.
#dddddddddd
ccccccccccc
eeeeeeeeeee
fffffffffff
I would like to remove the # sign and keep the text, for example:
dddddddddd
ccccccccccc
eeeeeeeeeee
fffffffffff
If you just want to manipulate a text file, a one-liner seems like the best solution. This will edit the file and keep a backup in “inputfile.txt.bak”.
Or you can do a shell redirection:
These will try to alter all the lines in the file. If you just want the first line altered you need something different: