Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sed for stripping out text

Posted on 2001-09-13
2
Medium Priority
?
194 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

618 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