On 02/12/2017 08:06 PM, bruce wrote:
> Hey guys.
> 
> Thanks for the delete replies..
> 
> Got a quick sed question now..
> 
> test file::
> head -2  sed.dat
> 228d98f0_f16a_11e6_9544_1ad613f05f7b,1486934882
> 22b93712_f16a_11e6_a6ad_1ad613f05f7b,1486934883
> 
> want to simply truncate/search/replace the end of each line starting
> with the ","
> to get
> 
> 228d98f0_f16a_11e6_9544_1ad613f05f7b
> 22b93712_f16a_11e6_a6ad_1ad613f05f7b
> 
> the following isn't working
>  sed -i 's/\,+\$//'  sed.dat
> 
>  sed -i 's/\,+$//'  sed.dat
> 
> I'm sure it's simple/trivial...
> 
> thoughts...
> _______________________________________________
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
> 
How about:
sed  's/,[0-9]\+$//' < sed.dat
228d98f0_f16a_11e6_9544_1ad613f05f7b
22b93712_f16a_11e6_a6ad_1ad613f05f7b

which removes a comma followed by 1 or more digits from the end of the
line. Or if you don't care what comes after the comma, then

sed  's/,.*$//' < sed.dat

will remove the comma and anything after it.



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org

Reply via email to