Remove first comma on each line in a file. I presume sed is needed.
This will only remove first first comma :(
vehomzzz
2010-03-19 15:00:43
Really? It works for me.
Beta
2010-03-19 15:04:31
Redirection isn't necessary.
Dennis Williamson
2010-03-19 15:41:25
@Dennis Williamson true, but I realized that too late; I can't edit now while the behavior is still in doubt.
Beta
2010-03-19 15:55:54
+7
A:
sed
sed -i.bak 's/,//' file
awk
awk '{sub(",","")}1' file >temp; mv temp file
shell
while read -r line
do
echo "${line/,/}"
done <"file" > temp
mv temp file
ghostdog74
2010-03-19 15:01:14
+1
A:
For first comma:
sed '/,//' < file
If first comma is first character:
sed '/^,//' < file
kzh
2010-03-21 01:17:18
My answer is contingent if you are using a *NIX OS. If not, well I am sure somebody will post a powershell answer.
kzh
2010-03-21 01:32:54
+1
A:
Yes,
first comma sed '/,//' < file
first character that is a comma sed '/^,//' < file
TMB
2010-03-21 01:37:12
this checks for a string with a comma as its first character and remove it. its is not the same as "first" comma
ghostdog74
2010-03-30 04:50:44