Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using CUT command to get only numerals from a string Post 302315898 by ghostdog74 on Wednesday 13th of May 2009 12:58:07 PM
Old 05-13-2009
Code:
echo $var1 |grep -Eo "[0-9]+"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read string, check string length and cut

Hello All, Plz help me with: I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Discussion started by: ozzy80
9 Replies

2. AIX

CUT command - cutting characters from end of string

Hello, I need to delete the final few characters from a parameter leaving just the first few. However, the characters which need to remain will not always be a string of the same length. For instance, the parameter will be passed as BN_HSBC_NTRS/hub_mth_ifce.sf. I only need the bit before the... (2 Replies)
Discussion started by: JWilliams
2 Replies

3. Shell Programming and Scripting

extracting only numerals from string.

Hi!!! i have two files "tushar20090429200000.txt" and "tushar_err20090429200000.txt" The numeric part here is date and time. So this part of file keeps changing after every hour. I want to extract the numeric part from the both file names and compare them whether they are equal or not. ... (4 Replies)
Discussion started by: tushar_tus
4 Replies

4. UNIX for Dummies Questions & Answers

Deleting lines starting with spaces then non-numerals

I did a search but couldn't find a thread that seemed to answer this but my apologies if it has been answered before. I have some text files and I need to remove any line that does not start with a number (0-9). In actuality every line like this starts with a 'T' (or 't') but there are a... (5 Replies)
Discussion started by: skray
5 Replies

5. Shell Programming and Scripting

How to select only those file names whose name contains only numerals.

Hi Guru's, Before writing to this forum I have searched extensively on this forum about my problem. I have to write a shell script which takes out only those file names from the given directory which contains only numbers. For example, In the given directory these files are present: ... (5 Replies)
Discussion started by: spranm
5 Replies

6. Shell Programming and Scripting

Sort roman numerals

If I use ls to print all the files of a folder, is there a way to sort using roman numerals? I am thinking about a result like: benjamin_I.wmv benjamin_II.wmv benjamin_II.wmv benjamin_III.wmv benjamin_IV.wmv benjamin_V.wmv benjamin_VI.wmv benjamin_VII.wmv benjamin_VIII.wmv... (6 Replies)
Discussion started by: locoroco
6 Replies

7. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

8. UNIX for Dummies Questions & Answers

Cut pid from ps using cut command

hay i am trying to get JUST the PID from the ps command. my command line is: ps -ef | grep "mintty" | cut -d' ' -f2 but i get an empty line. i assume that the delimiter is not just one space character, but can't figure out what should i do in order to do that. i know i can use awk or cut... (8 Replies)
Discussion started by: ran ber
8 Replies

9. Shell Programming and Scripting

Need a separator string between fields in cut -c command

Hi All, I'm trying to view data using cut command for a fixed length file using the below command: cut -c 1-3,4-5 FALCON_PIS_00000000.dat I want to mention a separator say | (pipe) in between 1-3 and 4-5. Please let me know how to achieve this. Thanks in Advance, (3 Replies)
Discussion started by: HemaV
3 Replies

10. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies
math::roman(1.0)														  math::roman(1.0)

__________________________________________________________________________________________________________________________________________________

NAME
math::roman - Tools for creating and manipulating roman numerals SYNOPSIS
package require Tcl 8.3 package require math::roman ?1.0? ::math::roman::toroman i ::math::roman::tointeger r ::math::roman::sort list ::math::roman::expr args _________________________________________________________________ DESCRIPTION
::math::roman is a pure-Tcl library for converting between integers and roman numerals. It also provides utility functions for sorting and performing arithmetic on roman numerals. This code was originally harvested from the Tcler's wiki at http://wiki.tcl.tk/1823 and as such is free for any use for any purpose. Many thanks to the ingeneous folk who devised these clever routines and generously contributed them to the Tcl community. While written and tested under Tcl 8.3, I expect this library will work under all 8.x versions of Tcl. COMMANDS
::math::roman::toroman i Convert an integer to roman numerals. The result is always in upper case. The value zero is converted to an empty string. ::math::roman::tointeger r Convert a roman numeral into an integer. ::math::roman::sort list Sort a list of roman numerals from smallest to largest. ::math::roman::expr args Evaluate an expression where the operands are all roman numerals. Of these commands both toroman and tointeger are exported for easier use. The other two are not, as they could interfer or be confused with existing Tcl commands. BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: roman of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
conversion, integer, roman numeral CATEGORY
Mathematics COPYRIGHT
Copyright (c) 2005 Kenneth Green <kenneth.green@gmail.com> Tcl Math Library math math::roman(1.0)
All times are GMT -4. The time now is 04:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy