Sponsored Content
Full Discussion: Convert text to numerical
Top Forums Shell Programming and Scripting Convert text to numerical Post 22787 by Perderabo on Monday 10th of June 2002 09:39:17 PM
Old 06-10-2002
First, please don't post your question in two parts in different areas of the forum like that. Post a followup to the original post if you need to add something. I have merged your posts into a single thread.

Now as for your question, you do not need to convery a string to numeric with ksh. It should work. But it sound like you variable "duplicate" is a filename. If so, you need to read the data from the file. If the file contains a single integer you can do this:

read num < $filename

if [[ $num -gt 1 ] ; then

If I have misunderstood, print out the value to see what we're dealing with:

echo duplicate = $duplicate

and post the results as a reply in this thread.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I convert unix text to to win text?

How do I convert unix text files into readable text for windows. Dave (1 Reply)
Discussion started by: nucca
1 Replies

2. Shell Programming and Scripting

convert Text to Excel

I have some text data generated by a perl script and want to put it into an excel sheet. Is there a perl script that can do this for me, i.e, convert text data to excel? (1 Reply)
Discussion started by: Pavankk
1 Replies

3. UNIX for Dummies Questions & Answers

How to convert text to columns in tab delimited text file

Hello Gurus, I have a text file containing nearly 12,000 tab delimited characters with 4000 rows. If the file size is small, excel can convert the text into coloumns. However, the file that I have is very big. Can some body help me in solving this problem? The input file example, ... (6 Replies)
Discussion started by: Unilearn
6 Replies

4. UNIX for Dummies Questions & Answers

Extracting rows from a text file based on numerical values of a column

I have a text file where the second column is a list of numbers going from small to large. I want to extract the rows where the second column is smaller than or equal to 0.0001. My input: rs10082730 9e-08 12 46002702 rs2544081 1e-07 12 46015487 rs1425136 1e-06 7 35396742 rs2712590... (1 Reply)
Discussion started by: evelibertine
1 Replies

5. Shell Programming and Scripting

Text Convert

Hello, I have a text file(utf8-bom). I want convert to following format. Thank you. 1***hello 35345 test test666 test 77 ? - test666 6//77 2***ktest 765 3***john6666 net 565433 nebb I want this format. 1***hello 35345 test test666 test 77 ? - test666 6//77 2***ktest 765... (4 Replies)
Discussion started by: kata33
4 Replies

6. Shell Programming and Scripting

Text Convert

Hello, I have a text file(utf8-bom). I want convert to following format. Thank you. 1***hello 35345 29***hello test6 380***bill33 4327***hello test6 47829***hull55 65644***hello test6 I want this format. 1***hello 35345 29***hello test6 380***bill33 4327***hello test6 2... (8 Replies)
Discussion started by: kata33
8 Replies

7. Shell Programming and Scripting

Convert text to CSV

Hi Gurus I need urgent help to convert a flat log file into csv format to load into database. Log looks like: a=1 b=2 c=3 a=4 b=5 c=6 Only the values at right side of = will come into csv and it should create a new line once it receives "a" field. (8 Replies)
Discussion started by: sandipjee
8 Replies

8. Shell Programming and Scripting

Bash to add portion of text to files in directory using numerical match

In the below bash I am trying to rename eachof the 3 text files in /home/cmccabe/Desktop/percent by matching the numerical portion of each file to lines 3,4, or 5 in /home/cmccabe/Desktop/analysis.txt. There will always be a match between the files. When a match is found each text file in... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

Convert text to csv

Hi, Is there somebody there to post an idea on how to convert this 5 liner row to 1 liner or tab delimiter to be import to database. Here the text file format: Description: Description1 Link: https://www.google.com Date: June 2, 2018 Time: 00:07:44 Age: 1 days ago Description:... (2 Replies)
Discussion started by: lxdorney
2 Replies

10. UNIX for Beginners Questions & Answers

Convert text to columns

Hi. I need an input file of a single word pr. line converted in into a list of random pairs. i need input like this word1 word2 word3 word4 to be outputted like this: word3 word1 word2 word4 My attempt is a tedious while loop like this: nfiles=$(cat inputfile | wc -l) ... (4 Replies)
Discussion started by: BotHead
4 Replies
ascii2uni(1)						      General Commands Manual						      ascii2uni(1)

NAME
ascii2uni - convert 7-bit ASCII representations to UTF-8 Unicode SYNOPSIS
ascii2uni [options] (<input file name>) DESCRIPTION
ascii2uni converts various 7-bit ASCII representations to UTF-8. It reads from the standard input and writes to the standard output. The representations understood are listed below under the command line options. If no format is specified, standard hexadecimal format (e.g. 0x00e9) is assumed. COMMAND LINE OPTIONS
-a <format> Convert from the specified format. Formats may be specified by means of the following arbitrary single character codes, by means of names such as "SGML_decimal", and by examples of the desired format. A Convert hexadecimal numbers with prefix U in angle-brackets (<U00E9>). B Convert x-escaped hex (e.g. x00E9) C Convert x escaped hexadecimal numbers in braces (e.g. x{00E9}). D Convert decimal HTML numeric character references (e.g. &#0233;) E Convert hexadecimal with prefix U (U00E9). F Convert hexadecimal with prefix u (u00E9). G Convert hexadecimal in single quotes with prefix X (e.g. X'00E9'). H Convert hexadecimal HTML numeric character references (e.g. &#x00E9;) I Convert hexadecimal UTF-8 with each byte's hex preceded by an =-sign (e.g. =C3=A9) . This is the Quoted Printable format defined by RFC 2045. J Convert hexadecimal UTF-8 with each byte's hex preceded by a %-sign (e.g. %C3%A9). This is the URIescape format defined by RFC 2396. K Convert octal UTF-8 with each byte escaped by a backslash (e.g. 303251) L Convert U-escaped hex outside the BMP, u-escaped hex within the BMP (U+0000-U+FFFF). M Convert hexadecimal SGML numeric character references (e.g. #xE9;) N Convert decimal SGML numeric character references (e.g. #233;) O Convert octal escapes for the three low bytes in big-endian order(e.g. 0000351)) P Convert hexadecimal numbers with prefix U+ (e.g. U+00E9) Q Convert HTML character entities (e.g. &eacute;). R Convert raw hexadecimal numbers (e.g. 00E9) S Convert hexadecimal escapes for the three low bytes in big-endian order (e.g. x00x00xE9) T Convert decimal escapes for the three low bytes in big-endian order (e.g. d000d000d233) U Convert u-escaped hexadecimal numbers (e.g. u00E9). V Convert u-escaped decimal numbers (e.g. u00233). X Convert standard hexadecimal numbers (e.g. 0x00E9). Y Convert all three types of HTML escape: hexadecimal and decimal character references and character entities. 0 Convert hexadecimal UTF-8 with each byte's hex enclosed within angle brackets (e.g. <C3><A9>). 1 Convert Common Lisp format hexadecimal numbers (e.g. #x00E9). 2 Convert Perl format decimal numbers with prefix v (e.g. v233). 3 Convert hexadecimal numbers with prefix $ (e.g. $00E9). 4 Convert Postscript format hexadecimal numbers with prefix 16# (e.g. 16#00E9). 5 Convert Common Lisp format hexadecimal numbers with prefix #16r (e.g. #16r00E9). 6 Convert ADA format hexadecimal numbers with prefix 16# and suffix # (e.g. 16#00E9#). 7 Convert Apache log format hexadecimal UTF-8 with each byte's hex preceded by a backslash-x (e.g. xC3xA9). 8 Convert Microsoft OOXML format hexadecimal numbers with prefix _x and suffix _ (e.g. _x00E9_). 9 Convert %u-escaped hexadecimal numbers (e.g. %u00E9). -h Help. Print the usage message and exit. -v Print program version information and exit. -m Accept deprecated HTML entities lacking final semicolon, e.g. "&#x00E9" in place of "&#x00E9;". -p Pure. Assume that the input consists entirely of escapes except for arbitrary (but non-null) amounts of separating whitespace. -q Be quiet. Do not chat unnecessarily. -Z <format> Convert input using the supplied format. The format specified will be used as the format string in a call to sscanf(3) with a single argument consisting of a pointer to an unsigned long integer. For example, to obtain the same results as with the -U flag, the for- mat would be: u%04X. If the format is Quoted-Printable, although it is not strictly speaking conversion of an ASCII escape to Unicode, in accordance with RFC 2045, if an equal-sign occurs at the end of an input line, both the equal-sign and the immediately following newline are skipped. All options that accept hexadecimal input recognize both upper- and lower-case hexadecimal digits. EXIT STATUS
The following values are returned on exit: 0 SUCCESS The input was successfully converted. 3 INFO The user requested information such as the version number or usage synopsis and this has been provided. 5 BAD OPTION An incorrect option flag was given on the command line. 7 OUT OF MEMORY Additional memory was unsuccessfully requested. 8 BAD RECORD An ill-formed record was detected in the input. SEE ALSO
uni2ascii(1) AUTHOR
Bill Poser <billposer@alum.mit.edu> LICENSE
GNU General Public License December, 2010 ascii2uni(1)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy