I need help in replacing the first string and only first string in n lines in a file.
The format is as follows:
Str1|str2|str3|str4|str5||
This is the format of the file and i need to replace only str1 in all the lines and keep the rest as it is.
I tried
sed -i “s#.*|||||#Test|||||#g” filename.txt
This replaces the first text with ‘Test‘ which Is fine but replaces the rest of the texts with