01-18-2008
extracting integer from data
Hi people,
I've encountered a problem. I have a data file like:
asd:$123:2
zxc:$456:4
But when I want to extract "$123" and get the number with this command:
echo $123 | cut -c 1-10
Im returned with 23 instead of 123.
Please help me out, thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I need to calculate the number of occurrences of a item in a number of files using Perl.
The item appears continually throughout the files but in each case I only want to calculate it in certain blocks of the file.
Example - Calculalte the number of occurrences of a 'pass' in a block of... (0 Replies)
Discussion started by: oop
0 Replies
2. Shell Programming and Scripting
frnds,
I m having prob woth doing some 2-3 task simultaneously...
what I want is...
I have lots ( lacs ) of files in a dir...
I want.. these info from arround 2-3 months files
filename convention is - abc20080403sdas.xyz ( for todays files )
I want
1. total no of files for 1 dec... (1 Reply)
Discussion started by: clx
1 Replies
3. UNIX for Dummies Questions & Answers
Given the following text in a file named extract.txt:
listenPort:=25
smtpDestination:=2
enableSSL:=
I am trying to extract only the value 2 following smtpDestination:=
Someone had suggested I use:
sed -e "s/^smtpDestination:=\(.*\)$/\1/" extract.txt
but this returns:
listenPort:=25
2
... (2 Replies)
Discussion started by: cleanden
2 Replies
4. UNIX for Dummies Questions & Answers
I have attached a txt file, what I would like to be able to do is:
1. Extract Data from Columns labeled E/N and Ko into a new file
2. Then in the new file I would like to be able to plot E/N on the X axis and Ko on the y axis.
3. Lastly I would like to be able to extract multiple data sets and... (6 Replies)
Discussion started by: gingburg
6 Replies
5. Shell Programming and Scripting
Folks
Appreciate your help in understanding issue in relation to below.
I need to pul uvalue from a file (tmpfile) and compare it with a number to make decision.
Using #!/bin/sh
contents of tmpfile :
Slot uvalue : 0.16
How I am pulling it:
unifval=`awk '/uvalue/ {print $4}' tmpfile` ... (1 Reply)
Discussion started by: wndgs
1 Replies
6. Shell Programming and Scripting
From the command line how would I extract data in file that was contained between parenthesis "()"? Awk or Grep?
Thanks in advance
Ted (11 Replies)
Discussion started by: TedSD
11 Replies
7. Shell Programming and Scripting
Hi
I have the following data :
<Cell id="34A" ref="ds:/BTS:34/Cells/Cell:34A"/>
<Cell id="34B" ref="ds:/BTS:34/Cells/Cell:34B"/>
<Cell id="34C" ref="ds:/BTS:34/Cells/Cell:34C"/>
I would like to print this data in the following format :
BTS:34 Cell:34A.I'm... (9 Replies)
Discussion started by: Prega
9 Replies
8. Shell Programming and Scripting
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
Discussion started by: Wynner
3 Replies
9. Shell Programming and Scripting
I have a txt file of the following format
>ab_
qwerty
>rt_
hfjkil
>Ty2
hglashglkasghkf;
>P2
aklhfklflkkgfgkfl
>ui_
vnllkdskkkffkfkkf
>we32
vksksjksj;lslsf'sk's's
....
.....
I want to split this big file based on the header (>) (5 Replies)
Discussion started by: Lucky Ali
5 Replies
10. UNIX for Dummies Questions & Answers
I am trying to compare the data in lines 3 & 5 to see if they match up to the '-S570' (see first code set, all proprietary information has been removed from code set)
spawn telnet
Trying ...
Connected to CA-LOS1234-ASE-S570.cl .
Escape character is '^]'.
CA-LOS1234-ASE-S570
Username: ... (1 Reply)
Discussion started by: slipshft
1 Replies
LEARN ABOUT PHP
msgfmt_format_message
MSGFMT_FORMAT_MESSAGE(3) 1 MSGFMT_FORMAT_MESSAGE(3)
MessageFormatter::formatMessage - Quick format message
Object oriented style
SYNOPSIS
publicstatic string MessageFormatter::formatMessage (string $locale, string $pattern, array $args)
DESCRIPTION
Procedural style
string msgfmt_format_message (string $locale, string $pattern, array $args)
Quick formatting function that formats the string without having to explicitly create the formatter object. Use this function when the
format operation is done only once and does not need and parameters or state to be kept.
PARAMETERS
o $locale
- The locale to use for formatting locale-dependent parts
o $pattern
- The pattern string to insert things into. The pattern uses an 'apostrophe-friendly' syntax; it is run through umsg_autoQuoteA-
postrophe before being interpreted.
o $args
- The array of values to insert into the format string
RETURN VALUES
The formatted pattern string or FALSE if an error occurred
EXAMPLES
Example #1
msgfmt_format_message(3) example
<?php
echo msgfmt_format_message("en_US", "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree
", array(4560, 123, 4560/123));
echo msgfmt_format_message("de", "{0,number,integer} Affen auf {1,number,integer} Baumen sind {2,number} Affen pro Baum
", array(4560, 123, 4560/123));
?>
Example #2
OO example
<?php
echo MessageFormatter::formatMessage("en_US", "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree
", array(4560, 123, 4560/123));
echo MessageFormatter::formatMessage("de", "{0,number,integer} Affen auf {1,number,integer} Baumen sind {2,number} Affen pro Baum
", array(4560, 123, 4560/123));
?>
The above example will output:
4,560 monkeys on 123 trees make 37.073 monkeys per tree
4.560 Affen auf 123 Baumen sind 37,073 Affen pro Baum
SEE ALSO
msgfmt_create(3), msgfmt_parse(3), msgfmt_get_error_code(3), msgfmt_get_error_message(3).
PHP Documentation Group MSGFMT_FORMAT_MESSAGE(3)