Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Parsing alphanumeric variables Post 302564938 by alpesh on Saturday 15th of October 2011 02:35:17 PM
Old 10-15-2011
Parsing alphanumeric variables

Hi All,

I have files with a column which has values and ranges, for example

colA colB
ERD1 3456
ERD2 [526887..526890]
ERD3 4456

I want to have the following output
colA colB colC
ERD1 3456 3456
ERD2 526887 526890
ERD3 4456 4456

Being a newbie to shell scripting ,I`m struggling to find the right commands.

Question 2.

I have an array of alphanumeric variables like 24S45M67N45M, 367M, 23M3D34M etc. There will be at least 1 M and at most 2 Ms in the strings
while the other alphabets may or may not be present.
I want to extract the number associated with the Ms. So the output will look like
24S45M67N45M 45 45
367M 367 0
23M3D34M 23 34

Please help !

Thanks,
Alpesh

So the ou at least 1
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing and getting values of variables

suppose i have a file value where it returns 3 values a=1 b=2 c=4 when i run it. i am using this file in my shell script. how do i parse and get the value of a b and c? (3 Replies)
Discussion started by: Rekha
3 Replies

2. Shell Programming and Scripting

alphanumeric comparision

I have a requirement where I need to check if where r1v07l09ab is a software release. I should always check for this to be true to continue the release deployment because an older release should not be deployed by mistake. I mean only the release greater than the current release should be... (3 Replies)
Discussion started by: rakeshou
3 Replies

3. Shell Programming and Scripting

Perl: parsing variables

I have the following script: #!/usr/bin/perl -w @files = <*.csv>; foreach $file (@files) { open(FH, $file); my @dt = split(/_|.csv/, $file); while (<FH>) { chomp; print $dt . $dt . ",$_\n"; } close(FH); } This script reads in all csv files in the current directory... (2 Replies)
Discussion started by: figaro
2 Replies

4. Shell Programming and Scripting

Parsing Directory Names for Use as Bash Variables

Hi all: I have a directory where all of the subdirectories are named by the convention "images_#1:#2_Date." My goal is to get an array for each subdirectory that has the structure (#1,#2, int). I am able to use awk to print each subdirectory's values, but cannot figure out how to get them into an... (6 Replies)
Discussion started by: aefskysa
6 Replies

5. UNIX for Advanced & Expert Users

alphanumeric Sorting

Hi , I have a requirement where one column have to be sorted (delimiter is pipe) for eg: My input filed is as below 1|FIAT|0010103|23011|01/01/2000|31/12/9999|1.15 2|232|613|1 2|234|743|1 2|234|793|1 2|234|893|1 1|FIAT|0010103|23012|01/01/2000|31/12/9999|1.15 2|230|006|0 2|230|106|0... (9 Replies)
Discussion started by: laxmi131
9 Replies

6. Shell Programming and Scripting

Help parsing logs maybe with menu and variables?

I would like to parse through some logs looking for things like exception or failed (grep -i failed). Ideal would be if it were in a menu format so someone without unix ability could just choose option 1 2 or 3 etc. If I could pass the hostname to a variable also that would be awesome, so someone... (5 Replies)
Discussion started by: taekwondo
5 Replies

7. UNIX for Dummies Questions & Answers

Issue with parsing config variables

I am using MKS tool kit on windows server. One config variable is defined in windows environment and I am trying to use that variable. # Below RootDir is defined in windows RootDir="\\f01\var" # in unix script details="$RootDir/src|$RootDir/tgt" src=`echo $details|awk -F '|' '{print... (1 Reply)
Discussion started by: madhukalyan
1 Replies

8. Shell Programming and Scripting

Comparing Alphanumeric Variables in Shell Script

Can someone please help me out here? I have strings similar to aafafaff45,29.34.942.45,edfdfafa that i want to compare to another similar string to check if they are the same. my script isn't working. ONE="aafafaff45,29.34.942.45,edfdfafa" TWO="ddfafagfa,87.57.942.45,afafafff" if ONE is... (5 Replies)
Discussion started by: SkySmart
5 Replies

9. Shell Programming and Scripting

Parsing fields into variables

A record contains 50 fields separated by "~". I need to assign each of these fields to different variables. Following is the shell script approach I tried. RECORD="FIELD1~FIELD2~FIELD3~FIELD4~FIELD5~...........~FIELD50" VAR1=$(echo ${RECORD} | cut -d"~" -f 1) VAR2=$(echo ${RECORD} | cut... (5 Replies)
Discussion started by: krishmaths
5 Replies

10. Shell Programming and Scripting

Parsing a file and setting to variables.

greetings all, I have a task right now that is somewhat stumping me, and I am not sure what the best approach is to take it. I have a text file that will contain something similar to the following: first1, other1 first2, other2 first3, other3 first4, other4 I have to generate an... (14 Replies)
Discussion started by: jeffs42885
14 Replies
RPMCACHE(8)							   Red Hat Linux						       RPMCACHE(8)

NAME
rpmcache - Cache RPM Package Headers SYNOPSIS
rpmcache [ PACKAGE_NAME ... ] DESCRIPTION
rpmcache walks a file tree, possibly remotely using FTP, filtering paths using glob(7) expressions, reading rpm package headers. The latest (i.e. comparing package epoch/version/release for identical package names and using the build time as a tie breaker) package headers, if they are unique, are cached in an rpm database. The rpm database cache can be used to provide suggested paths to packages that resolve unknown dependencies. There are no rpmcache specific options, only common rpm options. See the rpmcache usage message for what is currently implemented. The file tree path to be searched is configured using rpm macros. The final path is the concatentaion of 5 individual elements. Here are the macro names used to configure rpmcache, in the same order that they will be concatenated to build the file tree path that will be walked: %_bhpath The "path" level contains the leading part of the file tree path (or URL) for the file tree to be walked. No glob(7) expressions, here, please. %_bhcoll The "collection" level contains a string (or glob(7) expression) to match sub-directories of %_bhpath. %_bhN The "name" level contains a string (or glob(7) expression) to match sub-directories of %_bhcoll. The PACKAGE_NAME arguments are used to construct a glob(7) expression that will match any of specific package names within the Red Hat build system, and are almost certainly not of use to anyone outside of Red Hat. %_bhVR The "version-release" level contains a string (or glob(7) expression) to match sub-directories of %_bhN. %_bhA The "arch" level contains a string (or glob(7) expression) to match sub-directories of %_bhVR. The location of the cache database is also configured using an rpm macro: %_cache_dbpath The location of the cache database. The default value is /var/spool/up2date/cache. The cache database is identical in format to an rpm database, and can be used with rpm from the command line. For example, to use the cache database to provide suggestions for packages that provide dependencies needed by a package install, the following macro should be config- ured in either /etc/rpm/macros or ~/.rpmmacros: %_solve_dbpath The location of the database that is used to provide suggested dependency resolutions. Example (minimal) configuration for a Red Hat beehive tree: %_cache_dbpath /var/spool/up2date/cache %_solve_dbpath %{_cache_dbpath} %_bhpath file://localhost/mnt/redhat/beehive/comps/dist %_bhcoll 7.3 %_bhN @(basesystem|bash|filesystem|glibc-common|glibc|ldconfig|libtermcap|mktemp|setup|termcap) %_bhVR * %_bhA @(i[3456]86|noarch) Example (minimal) configuration for a Red Hat FTP tree: %_cache_dbpath /var/spool/up2date/cache %_solve_dbpath %{_cache_dbpath} %_bhpath ftp://localhost/mnt/dist %_bhcoll @(7.3|7.2|7.1|7.0|6.2|6.1|6.0|5.2|5.1|5.0) %_bhN @(%{_arch}) %_bhVR * %_bhA @(i[3456]86|noarch) BUGS
Yup. Please file bug reports and RFE's against the rpm-devel package using bugzilla: http://bugzilla.redhat.com/ <URL:http://bugzilla.red- hat.com/> SEE ALSO
rpm(8), glob(7), http://www.rpm.org/ <URL:http://www.rpm.org/> AUTHORS
Jeff Johnson <jbj@redhat.com> Red Hat, Inc. 05 July 2002 RPMCACHE(8)
All times are GMT -4. The time now is 04:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy