I have a file hashes which has many lines that look like this:
wget https://ipfs.io/ipfs/QmbKi6XiMmf4YfvKXhqVPymD1HDwJ3WqukjyLuEvnrZrCz The_Supremes_-_My_World_Is_Empty_Without_You_(lyrics).mkv
All the lines in hashes will follow the pattern:
wget https://ipfs.io/ipfs/hashthatis46characterlong nameOfAfileWithoutSpaces
as they are written by my script with the following lines of code:
find ~/pCloudDrive/VisualArts/Films/Fiction_Movies -maxdepth 1 -type f -size +200M -exec ipfs add --nocopy {} \;>>~/CS/ipfs/hashes && \
sed -i 's;added ;wget https://ipfs.io/ipfs/;g' ~/CS/ipfs/hashes
All hashes are going to be 46-character long and they typically start with 'Qm' but this may not necessarily be the case in the future.
I want to replace the second space of each line of this file with ' -O ' so that it looks like:
wget https://ipfs.io/ipfs/hashthatis46characterlong -O nameOfAfileWithoutSpaces
I tried sed 's/[0-9A-z]{46,46}\s/& -O /g' hashes but to no avail - I get the following output:
sed: -e expression #1, char 27: Invalid range end
How do I do this? Would awk present a better solution for this problem than sed?