Re: sed question!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 12, 2017 at 08:06:28PM -0500, 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...

I'm far from a sed expert, but were I doing that I'd start with this,
and move on from there as required:

's/,.*$//'

which is: comma followed by zero or more of anything, followed by end of line.

I think your expression says:
one or more commas, followed by end of line.

Fred

-- 
---- Fred Smith -- fredex@xxxxxxxxxxxxxxxxxxxxxx -----------------------------
                      The eyes of the Lord are everywhere, 
                    keeping watch on the wicked and the good.
----------------------------- Proverbs 15:3 (niv) -----------------------------
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux