Sponsored Content
Full Discussion: sed for string manipulation
Top Forums Shell Programming and Scripting sed for string manipulation Post 302994342 by RudiC on Tuesday 21st of March 2017 02:00:47 PM
Old 03-21-2017
PLEASE DON'T modify posts if people have already referred / answered to it, pulling the rug from under therir feet!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string manipulation

Hi, I have a file with rows of text like so : E100005568374098100000015667 D100005568374032000000112682 H100005228374060800000002430 I need to grab just the last digits(bolded) of each line without the proceeding text/numbers. Thanks (5 Replies)
Discussion started by: james6
5 Replies

2. Shell Programming and Scripting

How to use sed for string manipulation

Hi, I would like to know How to use use sed for manipulating string for the following situation. Basically my objective is to check validity of the filename in my shell script. I am getting a parameter like this for my shell script. Check my folder is having some space. $1=/root/krishna... (2 Replies)
Discussion started by: hikrishn
2 Replies

3. Shell Programming and Scripting

sed string manipulation

hi I am using sed to split a string this string is 11byteabc I would like to just get the numeric digits. echo "11byteabc" | sed 's/*// returns 11byteabc only solution that works is repeating number of times for the letters which is pointless grateful for any suggestions thanks (4 Replies)
Discussion started by: speedieB
4 Replies

4. UNIX for Dummies Questions & Answers

String manipulation

I am doing some training for a job I have just got and there is an exercise I am stuck with. I am not posting to ask a question about logic, just a trivial help with string manipulation. I would appreciate if somebody could at least give me a hint on how to do it. Basically, the intelligent part... (8 Replies)
Discussion started by: Dantastik
8 Replies

5. Shell Programming and Scripting

string manipulation

Hi all, see i have a script that takes few arguments. first one is command we do on file, next is file (mostly txt file with lot of data) third is destination where we do something with data in file. Since im new in scripting, and im learning as i go, i need some hint how to manipulate that... (3 Replies)
Discussion started by: ajemrunner
3 Replies

6. Shell Programming and Scripting

sed string manipulation in shell script

Hello, I have 1000 of sql queries and i need to push column value in query. e.g. SET INSERT_ID=1 INSERT INTO test (id,name) VALUES ('a'); SET INSERT_ID=2 INSERT INTO test (id,name) VALUES ('b'); SET INSERT_ID=3 INSERT INTO test (id,name) VALUES ('c'); SET INSERT_ID=4 INSERT INTO test... (12 Replies)
Discussion started by: mirfan
12 Replies

7. Shell Programming and Scripting

String Manipulation

Hi, I have a file in the following format 123|shanwer|15DEC2010|bgbh|okok|16JAN3000|okok| I want the following to be in following format 123|shanwer|12\15\2010|bgbh|okok|01\16\3000|okok| SED/PERL/AWK Gurus could you please help me with this? Thanks Shankar (8 Replies)
Discussion started by: Shan2210
8 Replies

8. Shell Programming and Scripting

string manipulation

Hi, I have the followoing details in one file: opt/tra/domain/test/new/filename1 training/ear/help I need to manipulate the string in the following manner: filename1= opt/tra/domain/test/new/filename1 help=training/ear/help last string is the name and equal sign and then... (2 Replies)
Discussion started by: ckchelladurai
2 Replies

9. Shell Programming and Scripting

Deleting part of a string : string manipulation

i have something like this... echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }' Certifica the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it. expected output is Certificate (7 Replies)
Discussion started by: vivek d r
7 Replies

10. Shell Programming and Scripting

Manipulation with the string using sed

hello All, When I run find command on certain directory I may get one of the following output depending on configuration A. ./rel/prod/libpam.a B. ./rel/fld/libpam.a C. ./deb/detail/libpam.a D. ./deb/err/libpam.a I want to get output as below A. rel/prod B.... (2 Replies)
Discussion started by: anand.shah
2 Replies
Base(3pm)						User Contributed Perl Documentation						 Base(3pm)

NAME
Convert::Units::Base - base object for performing unit conversions DESCRIPTION
The Units package is a collection of modules for parsing strings with unit measurements (such as "12pt" or "3 meters") and converting them to some other unit (such as "picas" or "inches"). It uses a base package (Units::Base) which does the dirty work. Other modules define what units they handle and how they are related. Why a Separate Module? It is intentionally distinct from the Math::Units module. Why? The Math::Units module implies that unit conversions are exact, with one-to- one relationships. This is fine for scientific work. It's even fine for some general purpose/real-world uses (such as converting Fehren- height to Celcius). Real-world measurement systems are conflicting. For instance, a "point" in typography is equivalent to 1/72 inch, according to PostScript specs and common usage. Other type systems consider it 1/72.27 inch, or 0.01383 inches, or 0.0148 inches. Outside of that context, a point may be 1/120 or 1/144 inch. Common notations and abbreviations also depend on context. Does "12 pt" mean "12 point", "12 parts" or "12 pints"? Even without conflicts in the definition of a particular unit, there's no need to convert point sizes for fonts into miles or light-years. Typesetters, surveyors and astronomers user different scales as well as systems. People do not think like computers Not everyone uses the metric system. And even less people say things like "5.25 feet". Often it's "5 feet, 3 inches" or "5 1/4 feet". Despite having ten fingers and toes, people don't think in tens. They think in twos, threes, fours, twelves, and sixteens. And sometimes they use fractional measurements like quarter-inches, sixteenths-of-an-inch, or half-pints. The purpose of this module is to allow people to use the measurement systems they are familiar with, and that is appropriate to what they are doing. Rationale The Units:: hierarchy is an attempt to keep measurement systems in distinct classes. Thus one can have modules for converting between typography units (points, picas) distinct from common units of length (or area, temperature, etc.), specialized units (for Astronomy, Chem- istry, Physics, Textiles, Winery, Navigation, etc.) or even traditional or regional systems (Japanese, Chinese, Egyptian, archaic systems, etc.) and to keep conflicting measurement systems distinct. Release Notes The current distribution contains the following packages: Convert::Units:: ::Base - a base module that does all of the work ::Length - a module for converting units of length ::Temperature - a module for converting units of temperature ::Type - a module for converting units of type Units::Base by itself does nothing. Another module needs to use it to create definitions of what units of measurement it handles and how they are related to each other (ie, 1 m = 100 cm). The base unit also allows for synonym and abbreviations to be defined. It also allows common "multiples" to be defined, so that it can handle things like "18 half-points" or "6 dozen feet" or even convert mil- limters to "sixteenths of an inch". (It does not yet handle Greek prefixes like centi- or mega- ... those will have to be manually defined.) Known Issues The current release should be considered "beta" until further testing and refinements have been made. Then again, maybe "alpha" is more accurate. The current version does not yet handle fractions such as "1/2 in". It should handle decimals such as "0.5 in". Relationships have been rewritten to be handle A(x+b) as well Ax. They may be redone in the future to handle more complex relationships, if the need arises. Unit names much be defined as all lowercase, since strings are munged with lc() before processing. In other words, if you define a unit name as "F" or "Fahrenheight" you won't be able to use it. Future Enhancements Aside from bug fixes, optimizations, and making the string parsing conform more to the "manifesto" above, obvious additions would be mod- ules for converting between units of area, volume, weight... (although if Math::Units does what you need, use that instead.) An example hierarchy for future modules: Convert::Units:: ::Length - general measures of length ::Area ::Pressure ::Volume Convert::Units::Length ::Chinese - specialized regional/traditional systems ::English Convert::Units::Astronomy ::Length - or Distance...? Modules should share a common unit (preferably metric) to allow for conversions. REQUIRED MODULES
Carp SEE ALSO
Units::Length, Units::Temperature and Units::Type modules, which demonstrate how Units::Base is used. AUTHOR
Robert Rothenberg <wlkngowl@unix.asb.com> LICENSE
Copyright (c) 1999-2000 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.8.8 2005-11-18 Base(3pm)
All times are GMT -4. The time now is 11:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy