Sponsored Content
Full Discussion: SED problem
Top Forums Shell Programming and Scripting SED problem Post 302260751 by Christoph Spohr on Friday 21st of November 2008 02:04:27 PM
Old 11-21-2008
Hi,

one way is:

Code:
sed 's!/[^/]*$!!' file

which will replaced everything from the / to the lineend by nothing.

HTH Chris
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sed Problem

I AM TRYING TO APPEND THE HOSTNAME OF A UNIX SERVER I WORK WITH SO I COULD DO A LOADING INTO A DATABASE. THE COMMAND I AM USING IS df -k | sed 's/^/dataserver /' What I intend to do is append the hostname dynamically by using the hostname command instead of having to manually enter... (1 Reply)
Discussion started by: Chelsea
1 Replies

2. UNIX for Dummies Questions & Answers

Problem with sed

Hi , echo "07/05/2008" | sed 's/\(..\)\/\(..\)\/\(..\)/\3\2\1/' Output :: 20050708 Expected output is 20080507 Iam not getting the bug in this. Thanks for the help -- penchal (4 Replies)
Discussion started by: penchal_boddu
4 Replies

3. Shell Programming and Scripting

Problem with SED

Hi, I have to use SED to remove the prefix "219-" from a text file containing phone numbers and I have to remove the ":" as well. I write the following code but it does not seem to work. Can someone help me please? mohit@mohit-desktop:~$ sed -n s/219-/" "/p corp_phones_bak > noprefix1... (2 Replies)
Discussion started by: mojoman
2 Replies

4. Shell Programming and Scripting

Problem in sed.

Hi All! I am trying to use shell variables in a sed statement, but facing an error.I used the double quotes instead if single quotes in the sed statement. # sed -i -e "s/password/$decoded/g;" $CATALINA_HOME/conf/server.xml sed: -e expression #1, char 11: unterminated `s' command # ... (5 Replies)
Discussion started by: nua7
5 Replies

5. Shell Programming and Scripting

Sed Problem

I have a file which contain many lines see below. "/var/www/abc>" I want to remove Both of these values "" and > (5 Replies)
Discussion started by: aliahsan81
5 Replies

6. Shell Programming and Scripting

SED - Problem

I have a file with a lot of numbers in it and I need to clean it up and make it look nice and proper. I found this little gem of a one-liner and basically understand what it is doing but I would like to further understand what each part of the command is doing. Being a newb, I am just trying to... (2 Replies)
Discussion started by: genedc1
2 Replies

7. Programming

sed problem

Hi all In input file I have records like this: 0,1,0,87,0,0,"6,87","170,03",0,"43,5",0,0,0,0,"6,87","126,53"and in output file I need that these records transforms in : 0 1 0 87 0 0 6,87 170,03 0 43,5 0 0 0 0 6,87 126,53 Could you help me in this case? Please (3 Replies)
Discussion started by: shizik
3 Replies

8. Shell Programming and Scripting

sed problem

Hi i am stuck with a very silly problem :mad: below is my code echo 201010_1212_121.xml i need to replace xml with csv so i did echo 201010_1212_121.xml | sed 's/.*\.xml/.*\.csv/' echo 201010_1212_121.xml | sed 's/*.xml/*.csv/' echo 201010_1212_121.xml |... (4 Replies)
Discussion started by: aishsimplesweet
4 Replies

9. UNIX for Dummies Questions & Answers

sed problem

Hi Folks, I want to replace these numbers with words as the following: $echo 1 11 223 I want to replace each number with it name (e.g. "1" replaced with "one", etc.) just to determine how sed works in such case. Thanks in advance:). Leo (8 Replies)
Discussion started by: leo_ultra_leo
8 Replies

10. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
cssutil(1)							      CRM114								cssutil(1)

  NAME
      cssutil - utility to measure and manipulate CRM114 statistics files.

  SYNOPSIS
      cssutil [.css file] [OPTIONS]

  WARNING
      This  man  page  is  taken from an older CRM114 version.	It is provided as a convenience to Debian users and may not be up-to-date.  If you
      would like to update it, please send appropriate patches to the Debian bug tracking system.

  OPTIONS
      -h
	 print basic help

      -b
	 brief - print only a summary of the statistics of the .css file (otherwise, prints a full list of how	many  bins  are  in  each  counter
	 state)

      -q
	 quiet mode; no warning messages

      -r
	 report then exit (no menu). The default if -r is not specified is to drop into a command-menu based system.

      -s
	 if no css file found, create new one with this many buckets. Default is 1 million + 1 buckets

      -S
	 same as -s, but round up to next 2^n + 1 boundary.

      -v
	 print version and exit

      -D
	 dump  css  file  to stdout in the architecture-independent CSV format, suitable for reloading with -R in an architecture. (note that .css
	 files are a hardware-architecture dependent format)

      -R
	 create and restore css from the hardware-architecture independent CSV format file (reads from stdin if csv-file is not supplied.

  THE COMMAND MENU
      If -r is not supplied, a menu appears with the following options. Note that all of these operations are "in place" and surgical- there is NO
      undo functionality. Wise users will make a backup copy of all .css files before using cssutil to alter values.

      -Z
	 zero  all  bins  at or below a value. This is useful for deleting all small-count features from the .css statistics files leaving higher-
	 count features untouched.

      -S
	 subtract a constant from all bins - this rolls all features back a constant amount.

      -D
	 divide all bins by a constant - this rolls features back linearly, rather than in scalar fashion.

      -R
	 rescan - regenerate the statistics output that was initially printed.

      -P
	 pack - re-slot features to optimize access time.

      -Q
	 - gracefully exit, saving changes. (note that since these operations are in-place and surgical, there is no option to exit without saving
	 changes.

  DESCRIPTION
      cssutil  is a general utility to manipulate and measure the .css format statistics files used by CRM114's Markovian and OSB classifiers. The
      biggest uses are to check the available space remaining in a .css file, to selectively groom a .css file, and to port architecture-dependent
      .css  files  to and from an ASCII CSV format, which is architecture independent.	The cssutil program can be used to create information-less
      .css files:

	   cssutil -b -r spam.css
	   cssutil -b -r nonspam.css

      . This creates the full-size files ./spam.css and ./nonspam.css, holding no information.	The cssutil program can be  used  check  that  the
      .css files are reasonable.  Invoke cssutil as:

	  cssutil -b -r spam.css
	  cssutil -b -r nonspam.css

      You should get back a report something like this:

	   Sparse spectra file spam.css statistics:

	   Total available buckets	    :	   1048576
	   Total buckets in use 	    :	    506987
	   Total hashed datums in file	    :	   1605968
	   Average datums per bucket	    :	      3.17
	   Maximum length of overflow chain :		39
	   Average length of overflow chain :	      1.84
	   Average packing density	    :	      0.48

      Note  that  the  packing density is 0.48; this means that this .css file is about half full of features. Once the packing density gets above
      about 0.9, you will notice that CRM114 will take longer to process text. The penalty is small below packing densities below about  0.95  and
      only about a factor of 2 at 0.97 .  Best is to keep it below .7 to .8.

  SHORTCOMINGS
      Note  that  cssutil  as  of version 20040816 is NOT capable of dealing with the CRM114 Winnow classifier's floating-point .cow files. Worse,
      cssutil is unaware of it's shortcomings, and will try anyway. The only recourse is to be aware of this issue and not use cssutil on a Winnow
      classifier floating point .cow format file.

  HOMEPAGE AND REPORTING BUGS
      http://crm114.sourceforge.net/

  VERSION
      This  manpage:  $Id:  cssutil.azm,v  1.4	2004/08/19  09:23:24  vanbaal  Exp $ This manpage describes cssutil as shipped with crm114 version
      20040816.BlameClockworkOrange.

  AUTHOR
      William S. Yerazunis. Manpage typesetting by Joost van Baal and Shalendra Chhabra

  COPYRIGHT
      Copyright (C) 2001, 2002, 2003, 2004 William S. Yerazunis. This is free software, copyrighted under the FSF's GPL. There is NO warranty; not
      even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more details.

  SEE ALSO
      cssmerge(1), cssdiff(1), crm(1)

  cssutil 20040816.BlameClockworkOrange-auto.3			      19 Aug 2004							  cssutil(1)
All times are GMT -4. The time now is 04:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy