Sponsored Content
Top Forums Shell Programming and Scripting How to check a column contain numeric or char data type ?? Post 302091672 by ghostdog74 on Wednesday 4th of October 2006 12:09:02 PM
Old 10-04-2006
Python alternative:
Code:
>>> for lines in open("clientname_filename.csv"):
... 	lines = lines.strip().split("|")
... 	if not lines[0].isdigit() or not lines[3].isdigit():
...  		print "First or  fourth col not numeric: %s" %(lines)
... 	elif not lines[1].isalnum():
... 		print "Second col not alphanumeric: %s" %(lines)
... 	elif not lines[2].isalpha():
... 		print "Third col not char type: %s" %(lines)

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to check the file data type(ascii or binary)

hi i am receiving a file from one system , i have to verify the format of the file data i.e whether the data is in acii format or binary format, please help thanks in advance satya (1 Reply)
Discussion started by: Satyak
1 Replies

2. Programming

check the given string is numeric or not.

Hi, how to check the given string is numeric or not , without converting ( using strtol...). for ex: if string is C01 - non-numeric data if string is 001 - numeric data TIA (11 Replies)
Discussion started by: knowledge_gain
11 Replies

3. Shell Programming and Scripting

Converting Char to Numeric

HI, Here I have the following output and want to do some mathematical calculation on C2 & C3 column. c1 c2 c3 c4 c5 l1 1-oct 12:30:01 12:35 abc xyz l2 1-oct 14:20:01 14:35 def ... (5 Replies)
Discussion started by: dear_abhi2007
5 Replies

4. Emergency UNIX and Linux Support

AWK - check column data

Hi, I have a data in a file . Infile: 1 e 1.2 1.6 5 f 2.3 3.6 3 g 1.2 2.6 6 i 2.3 3.6 8 o 1.2 3.6 output: 1 e 1.2 1.6 5 f 2.3 3.6 3 g 1.1 2.6 6 i 2.2 3.5 8 o 1.0 3.4 (17 Replies)
Discussion started by: vasanth.vadalur
17 Replies

5. Shell Programming and Scripting

How to check if a column is having a numeric value or not in a file?

Hi, I want to know, how we find out if a column is having a numeric value or not. For Example if we have a csv file as ASDF,QWER,GHJK,123,FGHY,9876 GHTY,NVHR,WOPI,623,HFBS,5386 we need to find out if the 4th and 6th column has muneric value or not. Thanks in advance Keerthan (9 Replies)
Discussion started by: keerthan
9 Replies

6. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

7. Shell Programming and Scripting

How to check for a Numeric Value?

Using shell, I have a variable, how can I check that variable for a numeric value such as "41.0"? My program needs to do one things if the numeric value is found, and another if something else such as a string of letter is found. is there a specific character that denotes a numeral? The... (2 Replies)
Discussion started by: chagan02
2 Replies

8. Shell Programming and Scripting

check if a string is numeric

I checked all the previous threads related to this and tried this. My input is all numbers or decimals greater than zero everytime. I want to check the same in the korn shell script. Just validate the string to be numeric. This is what I am doing. var="12345" if ) -o "$var" !=... (14 Replies)
Discussion started by: megha2525
14 Replies

9. Shell Programming and Scripting

Parsing of Char and Numeric in a file

Hi All, i'm working on some report and currently have this plain text file generated. server_name1|sdfd1deal | 1048572| 1040952| 99| 207| 1| 1 server_name1|dba1dbs | 83886048| 40730796| 48| 5762| 22764| 8... (4 Replies)
Discussion started by: fedora132010
4 Replies

10. Shell Programming and Scripting

Need to add a numeric & special char to end of the first line

Need to add a numeric & special char to end of the first line Existing file: 12-11-16|11 2016 Jan 12:34:55|03:55| 13-10-16|10 2016 Jan 12:34:55|03:55|12-11-16|11 2016 Jan 12:34:55|03:55| 14-10-16|19 2016 Jan 12:34:55|03:55|13-11-16|11 2016 Jan 12:34:55|04:55| 15-10-16|18 2016 Jan... (11 Replies)
Discussion started by: Joselouis
11 Replies
term(5) 						Standards, Environments, and Macros						   term(5)

NAME
term - conventional names for terminals DESCRIPTION
Terminal names are maintained as part of the shell environment in the environment variable TERM. See sh(1), profile(4), and environ(5). These names are used by certain commands (for example, tabs, tput, and vi) and certain functions (for example, see curses(3CURSES)). Files under /usr/share/lib/terminfo are used to name terminals and describe their capabilities. These files are in the format described in terminfo(4). Entries in terminfo source files consist of a number of comma-separated fields. To print a description of a terminal term, use the command infocmp -I term. See infocmp(1M). White space after each comma is ignored. The first line of each terminal description in the terminfo database gives the names by which terminfo knows the terminal, separated by bar (|) characters. The first name given is the most common abbreviation for the terminal (this is the one to use to set the environment variable TERMINFO in $HOME/.profile; see pro- file(4)), the last name given should be a long name fully identifying the terminal, and all others are understood as synonyms for the ter- minal name. All names but the last should contain no blanks and must be unique in the first 14 characters; the last name may contain blanks for readability. Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware mak- ing up the terminal should have a root name chosen, for example, for the AT&T 4425 terminal, att4425. This name should not contain hyphens, except that synonyms may be chosen that do not conflict with other names. Up to 8 characters, chosen from the set a through z and 0 through 9, make up a basic terminal name. Names should generally be based on original vendors rather than local distributors. A terminal acquired from one vendor should not have more than one distinct basic name. Terminal sub-models, operational modes that the hardware can be in, or user preferences should be indicated by appending a hyphen and an indicator of the mode. Thus, an AT&T 4425 terminal in 132 column mode is att4425-w. The following suffixes should be used where possible: Suffix Meaning Example -w Wide mode (more than 80 columns) att4425-w -am With auto. margins (usually vt100-am default) -nam Without automatic margins vt100-nam -n Number of lines on the screen aaa-60 -na No arrow keys (leave them in local) c100-na -np Number of pages of memory c100-4p -rv Reverse video att4415-rv To avoid conflicts with the naming conventions used in describing the different modes of a terminal (for example, -w), it is recommended that a terminal's root name not contain hyphens. Further, it is good practice to make all terminal names used in the terminfo(4) database unique. Terminal entries that are present only for inclusion in other entries via the use= facilities should have a '+' in their name, as in 4415+nl. Here are some of the known terminal names: (For a complete list, enter the command ls -C /usr/share/lib/terminfo/? ). 2621,hp2621 Hewlett-Packard 2621 series 2631 Hewlett-Packard 2631 line printer 2631-c Hewlett-Packard 2631 line printer, compressed mode 2631-e Hewlett-Packard 2631 line printer, expanded mode 2640,hp2640 Hewlett-Packard 2640 series 2645,hp2645 Hewlett-Packard 2645 series 3270 IBM Model 3270 33,tty33 AT&T Teletype Model 33 KSR 35,tty35 AT&T Teletype Model 35 KSR 37,tty37 AT&T Teletype Model 37 KSR 4000a Trendata 4000a 4014,tek4014 TEKTRONIX 4014 40,tty40 AT&T Teletype Dataspeed 40/2 43,tty43 AT&T Teletype Model 43 KSR 4410,5410 AT&T 4410/5410 in 80-column mode, version 2 4410-nfk,5410-nfk AT&T 4410/5410 without function keys, version 1 4410-nsl,5410-nsl AT&T 4410/5410 without pln defined 4410-w,5410-w AT&T 4410/5410 in 132-column mode 4410v1,5410v1 AT&T 4410/5410 in 80-column mode, version 1 4410v1-w,5410v1-w AT&T 4410/5410 in 132-column mode, version 1 4415,5420 AT&T 4415/5420 in 80-column mode 4415-nl,5420-nl AT&T 4415/5420 without changing labels 4415-rv,5420-rv AT&T 4415/5420 80 columns in reverse video 4415-rv-nl,5420-rv-nl AT&T 4415/5420 reverse video with- out changing labels 4415-w,5420-w AT&T 4415/5420 in 132-column mode 4415-w-nl,5420-w-nl AT&T 4415/5420 in 132-column mode without changing labels 4415-w-rv,5420-w-rv AT&T 4415/5420 132 columns in reverse video 4418,5418 AT&T 5418 in 80-column mode 4418-w,5418-w AT&T 5418 in 132-column mode 4420 AT&T Teletype Model 4420 4424 AT&T Teletype Model 4424 4424-2 AT&T Teletype Model 4424 in dis- play function group ii 4425,5425 AT&T 4425/5425 4425-fk,5425-fk AT&T 4425/5425 without function keys 4425-nl,5425-nl AT&T 4425/5425 without changing labels in 80-column mode 4425-w,5425-w AT&T 4425/5425 in 132-column mode 4425-w-fk,5425-w-fk AT&T 4425/5425 without function keys in 132-column mode 4425-nl-w,5425-nl-w AT&T 4425/5425 without changing labels in 132-column mode 4426 AT&T Teletype Model 4426S 450 DASI 450 (same as Diablo 1620) 450-12 DASI 450 in 12-pitch mode 500,att500 AT&T-IS 500 terminal 510,510a AT&T 510/510a in 80-column mode 513bct,att513 AT&T 513 bct terminal 5320 AT&T 5320 hardcopy terminal 5420_2 AT&T 5420 model 2 in 80-column mode 5420_2-w AT&T 5420 model 2 in 132-column mode 5620,dmd AT&T 5620 terminal 88 columns 5620-24,dmd-24 AT&T Teletype Model DMD 5620 in a 24x80 layer 5620-34,dmd-34 AT&T Teletype Model DMD 5620 in a 34x80 layer 610,610bct AT&T 610 bct terminal in 80-column mode 610-w,610bct-w AT&T 610 bct terminal in 132-col- umn mode 630,630MTG AT&T 630 Multi-Tasking Graphics terminal 7300,pc7300,unix_pc AT&T UNIX PC Model 7300 735,ti Texas Instruments TI735 and TI725 745 Texas Instruments TI745 dumb generic name for terminals that lack reverse line-feed and other special escape sequences hp Hewlett-Packard (same as 2645) lp generic name for a line printer pt505 AT&T Personal Terminal 505 (22 lines) pt505-24 AT&T Personal Terminal 505 (24-line mode) sync generic name for synchronous Tele- type Model 4540-compatible termi- nals Commands whose behavior depends on the type of terminal should accept arguments of the form -Tterm where term is one of the names given above; if no such argument is present, such commands should obtain the terminal type from the environment variable TERM, which, in turn, should contain term. FILES
/usr/share/lib/terminfo/?/* compiled terminal description database SEE ALSO
sh(1), stty(1), tabs(1), tput(1), vi(1), infocmp(1M), curses(3CURSES), profile(4), terminfo(4), environ(5) SunOS 5.10 3 Jul 1990 term(5)
All times are GMT -4. The time now is 07:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy