dendenners
Programmer
Hi,
I need to extract the first line from a file, manipulate a section of the line and re-insert it into the file. The problem I'm encountering is that I don't seem to be able to preserve trailing whitespace in the line when I pass it into a variable. At the moment, I'm carving up the line like this:
echo "$header_line" | cut -c54-$header_line_length | read new_header_line_3
However, when I access $new_header_line_3, the variable is truncated and trailing whitespace has disappeared! I'm sure there is a way around this using awk or something, but I don't seem to be able to get it to work. Thank you.
I need to extract the first line from a file, manipulate a section of the line and re-insert it into the file. The problem I'm encountering is that I don't seem to be able to preserve trailing whitespace in the line when I pass it into a variable. At the moment, I'm carving up the line like this:
echo "$header_line" | cut -c54-$header_line_length | read new_header_line_3
However, when I access $new_header_line_3, the variable is truncated and trailing whitespace has disappeared! I'm sure there is a way around this using awk or something, but I don't seem to be able to get it to work. Thank you.