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
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT OPENDARWIN
strfromd
STRFROMD(3) Linux Programmer's Manual STRFROMD(3)
NAME
strfromd, strfromf, strfroml - convert a floating-point value into a string
SYNOPSIS
#include <stdlib.h>
int strfromd(char *restrict str, size_t n,
const char *restrict format, double fp);
int strfromf(char *restrict str, size_t n,
const char *restrict format, float fp);
int strfroml(char *restrict str, size_t n,
const char *restrict format, long double fp);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
strfromd(), strfromf(), strfroml():
__STDC_WANT_IEC_60559_BFP_EXT__
DESCRIPTION
These functions convert a floating-point value, fp, into a string of characters, str, with a configurable format string. At most n charac-
ters are stored into str.
The terminating null character ('