$ ls *
2000-01-01-abcd.md
2000-01-01-cdef.md
I can extract abcd and cdef from the following command
find *.md -exec sh -c "echo {} | sed 's/.md//' | sed 's/2000-01-01-//'" \;
I know how to add a string in the beginning of the file via sed '1s/^/string/'
, but how do I pass the exact string?
How do I pass this string "abcd" and "cdef" in the corresponding files, because I want to add the corresponding strings in each and every file in the beginning of the file.