I'm no expert on sed, but '^' denotes the start of the line, '&' the string searched for, '.' any character and '*' anything, or nothing. So s/^.*/today&/ ought to substitute the start of the line followed by at least one character (so as to ignore blank lines), replacing it with the same thing but with "today" in front of it. The one at the end, I think, means to only do it once, but I'm not so sure about that. As all your files are meant to have one line, I believe you said, that would do the trick but be unneccessaru./
Code:
grim@21:54:16:~$ echo woof | sed 's/^.*/today&/1'
todaywoof
The '<' sign pipes the file into the command. You are assigning a variable and reading the contents of the file into it with the cat command. Say you wanted to replace all the 'a's in a one line file with 'b's, you could do it like this:
cat file.in | sed 's/a/b/g' >file.out
or like this:
sed 's/a/b/g' < file.in >> file.out
Or by assigning a variable:
var="$(cat file.in)"
echo "$var" | sed 's/a/b/g' >> file.out
All do the same thing.