02-22-2013
Thanks a lot, I am very impress, really!
It works very well for my example but indeed I have forgot to say that
-each line start with 1 or more whitespace
-first value can be negative so first char can be "-"
10 More Discussions You Might Find Interesting
1. Programming
For kicks I wrote up a Password generator after lunch. Let me start with the code:
unsigned int x,y,z,c;
unsigned int KISS();
unsigned int devrand();
int main( int argc, char** argv )
{
int i, j = 1;
char pwd = "abcdefghijklmnopqrstuvwxyz"
... (5 Replies)
Discussion started by: VRoemer
5 Replies
2. Shell Programming and Scripting
Here is my scenario, I have two columns. I need to add the first columns (the easy part). The second column is a percent that I need to subtract by 100 then multiply against the first column for each line, then sum the output for a total
Here is the input:
942330863 96
942172150 95... (4 Replies)
Discussion started by: mminaz
4 Replies
3. Shell Programming and Scripting
Hi All,
I have tried few things with this but it did not help much.
I have some 200,000 files in a directory. There are two sets of files.
1. Files with extension .dat with file names like these (1.dat, 2.dat, 5.dat, 8.dat....200000.dat)
2. Another set of files with .txt extension and... (5 Replies)
Discussion started by: shoaibjameel123
5 Replies
4. Shell Programming and Scripting
Hi everyone,
Please help on this:
I have file1:
<file title="Title 1 and 2">
<report>
<title>Title 1</title>
<number>No. 1234</number>
<address>Address 1</address>
<date>October 07, 2009</date>
<description>Some text</description>
</report>
... (6 Replies)
Discussion started by: Ophiuchus
6 Replies
5. Shell Programming and Scripting
HI help
i have
cc 9+37.50 328611.50 688498.25 42.38
cc 66+62.50 328636.50 688498.42 42.58
i want to make o/p
cc 9+3750 328611.50 688498.25 42.38
cc 66+6250 328636.50 688498.42 42.58
plz help (2 Replies)
Discussion started by: Indra2011
2 Replies
6. UNIX for Dummies Questions & Answers
Hi All !
As a dummy, I try to search for multiple string of characters contained in 2 types of list.
Not clear? No it's not.
Example:
I have a tab-delimited file called "inventory" with 2 columns that looks like that:
#ref #year,color
xrt3 2000,blue
gf5 2000,red,green,yellow... (4 Replies)
Discussion started by: lucasvs
4 Replies
7. Shell Programming and Scripting
In advance, I appreciate any help or tips. I apologize for not providing examples of scripts I have already tried, the reason is that I am new to programming and do not really no where to start. I think this is possible with awk, but do not know how to go about learning how to write the script... (2 Replies)
Discussion started by: awc228
2 Replies
8. Shell Programming and Scripting
I have a file that reports the size of disks GB's or TB's - I need the file to report everything in MB's. Here is an extract of the file - the last column is the disk size.
19BC 2363 20G
1AA3 2363 2.93T
1A94 2363 750G
Whenever I come across a G I want to delete the G and multiply by... (2 Replies)
Discussion started by: kieranfoley
2 Replies
9. Shell Programming and Scripting
Judi # cat File1
judi /export/home 76
judi /usr 83
judi #
judi # cat File2
judi /export/home 79
judi /usr 82
judi #
if COLUMN3 of File2 is greater that COLUMN3 of File1, then print File2's lines
juid /export/home 79
Code tags please (2 Replies)
Discussion started by: judi
2 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
I extracted a file using an awk command like this
awk '{print substr($0,78,5)"," substr($0,59,6) "," substr($0,81,3) "," substr($0,11,7)}' file1 >> OUTPUT
cat OUTPUT
00001,100000,005,0000080
00001,100000,008,0000220
00001,100000,001,0001000
00010,100000,001,0000400
I want... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
LEARN ABOUT CENTOS
stringlabels
StringLabels(3) OCaml library StringLabels(3)
NAME
StringLabels - String operations.
Module
Module StringLabels
Documentation
Module StringLabels
: sig end
String operations.
val length : string -> int
Return the length (number of characters) of the given string.
val get : string -> int -> char
String.get s n returns character number n in string s . The first character is character number 0. The last character is character number
String.length s - 1 . You can also write s.[n] instead of String.get s n .
Raise Invalid_argument index out of bounds if n is outside the range 0 to (String.length s - 1) .
val set : string -> int -> char -> unit
String.set s n c modifies string s in place, replacing the character number n by c . You can also write s.[n] <- c instead of String.set s
n c . Raise Invalid_argument index out of bounds if n is outside the range 0 to (String.length s - 1) .
val create : int -> string
String.create n returns a fresh string of length n . The string initially contains arbitrary characters. Raise Invalid_argument if n < 0
or n > Sys.max_string_length .
val make : int -> char -> string
String.make n c returns a fresh string of length n , filled with the character c . Raise Invalid_argument if n < 0 or n >
Sys.max_string_length .
val copy : string -> string
Return a copy of the given string.
val sub : string -> pos:int -> len:int -> string
String.sub s start len returns a fresh string of length len , containing the characters number start to start + len - 1 of string s .
Raise Invalid_argument if start and len do not designate a valid substring of s ; that is, if start < 0 , or len < 0 , or start + len >
StringLabels.length s .
val fill : string -> pos:int -> len:int -> char -> unit
String.fill s start len c modifies string s in place, replacing the characters number start to start + len - 1 by c . Raise Invalid_argu-
ment if start and len do not designate a valid substring of s .
val blit : src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> unit
String.blit src srcoff dst dstoff len copies len characters from string src , starting at character number srcoff , to string dst , start-
ing at character number dstoff . It works correctly even if src and dst are the same string, and the source and destination chunks overlap.
Raise Invalid_argument if srcoff and len do not designate a valid substring of src , or if dstoff and len do not designate a valid sub-
string of dst .
val concat : sep:string -> string list -> string
String.concat sep sl concatenates the list of strings sl , inserting the separator string sep between each.
val iter : f:(char -> unit) -> string -> unit
String.iter f s applies function f in turn to all the characters of s . It is equivalent to f s.[0]; f s.[1]; ...; f s.[String.length s -
1]; () .
val iteri : f:(int -> char -> unit) -> string -> unit
Same as String.iter , but the function is applied to the index of the element as first argument (counting from 0), and the character itself
as second argument.
Since 4.00.0
val map : f:(char -> char) -> string -> string
String.map f s applies function f in turn to all the characters of s and stores the results in a new string that is returned.
Since 4.00.0
val trim : string -> string
Return a copy of the argument, without leading and trailing whitespace. The characters regarded as whitespace are: ' ' , '