Solved

sed for stripping out text

Posted on 2001-09-13
2
190 Views
Last Modified: 2010-04-21
I am trying to use sed to strip out everything after the comma in a file that contains the following text:

#text1-text2,text1.text2,,,,text
#text31-text32,text31.text32,,,,text
etc

I want to be left with

#text1-text2
#text31-text32
etc

I am using sed for windows and the command I am using is:

sed "s/,*$//" < input.txt >output.txt

it is not working and I can't work out what I am doing wrong.

Can anyone help?

Craigggg

0
Comment
Question by:craigggg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
interiot earned 100 total points
ID: 6481071
sed "s/,.*$//" < input.txt >output.txt


* in regular expressions is different than globs

* means "match the previous character 0 or more times"
. means "match any character"
0
 

Author Comment

by:craigggg
ID: 6481855
Unfortunately I did manage to work it out last night, but your answer is bang on.  Thanks for the guidance.

Craigggg
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question