Solved

sed for stripping out text

Posted on 2001-09-13
2
185 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now