Sponsored Content
Top Forums Shell Programming and Scripting To test whether a field contains string value Post 303003904 by Sang on Friday 22nd of September 2017 11:47:29 AM
Old 09-22-2017
Pipe delimter.Tried to get that specific field value
Code:
cut -d "|" -f 26 filename | head

From the above I found 10 values with all numbers . File is huge . With Grep I have to specify all characters But I don't that way .I just want a command to check whether characters are available in this field . Based on this I will decide it's datatype.

Last edited by MadeInGermany; 09-22-2017 at 01:01 PM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string test?

hey guys- what is the syntax for a string test to verify that a user has entered a 6 digit numeric? Thanks for your help in advance! Todd (9 Replies)
Discussion started by: hedrict
9 Replies

2. UNIX for Dummies Questions & Answers

test a string...

Hi! I'm using echo $string | grep "" -c to test in a script if a string is a number and it seems to work. But how can i find, for example, if a string is a four figures number ? Thanks to all! (2 Replies)
Discussion started by: Kaminski
2 Replies

3. Shell Programming and Scripting

Test on string containing spacewhile test 1 -eq 1 do read a $a if test $a = quitC then break fi d

This is the code: while test 1 -eq 1 do read a $a if test $a = stop then break fi done I read a command on every loop an execute it. I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test. For example echo hello. Now the... (1 Reply)
Discussion started by: Max89
1 Replies

4. Shell Programming and Scripting

How to check weather a string is like test* or test* ot *test* in if condition

How to check weather a string is like test* or test* ot *test* in if condition (5 Replies)
Discussion started by: johnjerome
5 Replies

5. Shell Programming and Scripting

string test in IF statement

How do I test multiple words in a string test like below: if ] then print "You entered $TBS name.\n" else print "You entered an incorrect response.\n" fi This test does not work. I have tried different syntax versions. How does this work? And is there a better way to do it? ... (10 Replies)
Discussion started by: djehresmann
10 Replies

6. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

7. Shell Programming and Scripting

string test

How do I use bash to test if a line begins with a random number of spaces followed by a letter? (1 Reply)
Discussion started by: locoroco
1 Replies

8. Shell Programming and Scripting

test for a blank string

Hi guys I am performing a simple test for a blank string with the following code: if ] ]] ; then echo "Blanks are NOT a valid input " return 1 fi The above fails giving a syntax error message: syntax error at line 142 : `=~' unexpected I am in ksh88 is there... (2 Replies)
Discussion started by: aoussenko
2 Replies

9. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

10. UNIX for Beginners Questions & Answers

awk Associative Array and/or Referring to Field by String (Nonconstant String Value)

I will start with an example of what I'm trying to do and then describe how I am approaching the issue. File PS028,005 Lexeme HRS # M # PhraseType 1(1:1) 7(7) PhraseLab 501 503 ClauseType ZYq0 PS028,005 Lexeme W # L> # BNH # M #... (17 Replies)
Discussion started by: jvoot
17 Replies
FORMS(3)						   BSD Library Functions Manual 						  FORMS(3)

NAME
field_opts, field_opts_off, field_opts_on, set_field_opts -- form library LIBRARY
Curses Form Library (libform, -lform) SYNOPSIS
#include <form.h> Form_Options field_opts(FIELD *field); int field_opts_off(FIELD *field, Form_Options options); int field_opts_on(FIELD *field, Form_Options options); int set_field_opts(FIELD *field, Form_Options options); DESCRIPTION
The function field_opts() returns the current options settings for the given field. The field_opts_off() will turn the options given in options off for the given field, options not specified in options will remain unchanged. Conversely, the function field_opts_on() will turn on the options given in options for the specified field, again, any options not specified will remain unchanged. The options for a field may be set to a specific set of options by calling the set_field_opts() function. Options may only be changed if the field given is not the cur- rently active one. PARAMETERS
The following options are available for a field: O_VISIBLE The field is visible, hence is displayed when the form is posted. O_ACTIVE The field is active in the form, meaning that it can be visited during form processing. O_PUBLIC The contents of the field are echoed to the screen. O_EDIT The contents of the field can be modified O_WRAP The contents of the field are wrapped on a word boundary, if this option is off then the field will be wrapped on a character boundary. O_BLANK Blank the field on new data being entered if and only if the field cursor is at the left hand side of the field. O_AUTOSKIP Skip to the next field when the current field reaches its maximum size. O_NULLOK The field is allowed to contain no data O_STATIC The field is not dynamic, it has a fixed size. O_PASSOK An unmodified field is allowed. O_REFORMAT Retain the formatting of a field when the buffer is retrieved. If this option is not set then the buffer returned will be a sin- gle string with no line breaks. When this option is set newline characters will be inserted at the point where the string has been wrapped in a multiline field. This option is an extension to the forms library and must not be used in portable code. See the field_buffer(3) man page for how this option modifies the behaviour of field_buffer(). The following options are on by default for a field: O_VISIBLE, O_ACTIVE, O_PUBLIC, O_EDIT, O_WRAP, O_BLANK, O_AUTOSKIP, O_NULLOK, O_PASSOK, and O_STATIC. RETURN VALUES
Functions returning pointers will return NULL if an error is detected. The functions that return an int will return one of the following error values: E_OK The function was successful. E_CURRENT The field specified is the currently active one in the form. SEE ALSO
curses(3), forms(3) NOTES
The header <form.h> automatically includes both <curses.h> and <eti.h>. The option O_REFORMAT is a NetBSD extension and must not be used in portable code. BSD
November 24, 2004 BSD
All times are GMT -4. The time now is 05:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy