Sponsored Content
Top Forums Shell Programming and Scripting check for not null string in file Post 302093764 by ghostdog74 on Monday 23rd of October 2006 09:35:45 AM
Old 10-23-2006
Python alternative:

Code:
for linenumber, line in enumerate(open("inputfile.txt")):
 	if line[4:10] == '': 
               print "No data at line: %d" % linenumber

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

check for NULL variable

Hello I want to check for NULL variable.. but this is not working..please help thanks in advance esham (2 Replies)
Discussion started by: esham
2 Replies

2. Shell Programming and Scripting

How to check for null or empty string

Hi, I need to check for value not equal (<>) to 21 and not equal empty or null values. Please modify this script if then echo "$VALUE,$BSC_NAME,$BSC_ID" > $OUT_FILE/power_up.out end if TQ (5 Replies)
Discussion started by: doer
5 Replies

3. Shell Programming and Scripting

How to check Null values in a file column by column if columns are Not NULLs

Hi All, I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies

4. Shell Programming and Scripting

How to check for null value from makefile

My makefile has some code as follows: if ; then \ echo copying tools; \ cp -f `../${TOOLS_ROOT_PATH}/ext_tools.sh 1` ${EXTERNAL_BIN_DIR} || exit $$?;\ fi; \ The ext_tools.sh is as follows: cat ttx.conf | grep external | grep -v ^# | awk '{print $1}' It can sometime result... (1 Reply)
Discussion started by: jake_ryan
1 Replies

5. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 Replies

6. Shell Programming and Scripting

check for null

hi, i have 3 lines of output , if second line exists then only condition within the if loop has to exeute other wise it has exit from loop. i had tried like this but not getting please help me ... Code: if ; then echo "success" else echo "" Use code tags please,... (8 Replies)
Discussion started by: sreelu
8 Replies

7. Shell Programming and Scripting

Check for null

Hi Champs!!! im a newbie in unix, need ur expert help for my problem... I need to search if there are any "NULL" entries in the string String without Null Str1: 203652|1000003653|tellt|RUPV|4649|1|07/28/2011 01:56:12 String with Null (RUPV is removed) Str2:... (5 Replies)
Discussion started by: guruprasad7
5 Replies

8. Shell Programming and Scripting

NULL Search String & File Name

Hi All, I am writting a Sell Script, that takes Search String & File Name from the terminal and check for Null Status. If either is NULL then pgm should quit. I wrote the following: bash-3.2$ cat null_status_of_parameters.sh #!/bin/sh #WASS that takes Search String & File Name from... (2 Replies)
Discussion started by: manishdivs
2 Replies

9. Shell Programming and Scripting

Check file for string existence before appending it with string

I want to append file with a string but before doing that i want to check if this string already exist in that file.I tried with grep on Solaris 10 but unsuccessful.Man pages from grep seems to suggest if the string is found command status will be 0 and if not 1.But i am not finding it.May be i... (2 Replies)
Discussion started by: sahil_shine
2 Replies

10. UNIX for Dummies Questions & Answers

Check for not null column in a pipe delimited file

Hi, I have a requirement where I have to check whether the mandatory columns in a pipe delimited file is null and print error message. For eg, I have to check if the 3rd,5th,6th,7th and 8th column are null and print the message "<column name> is null". The data file will have aroung 100,000... (6 Replies)
Discussion started by: reshma15193
6 Replies
more(1) 						      General Commands Manual							   more(1)

Name
       more, page - display file data at your terminal

Syntax
       more [-cdflsu] [-n] [+linenumber] [+/pattern] [name...]

       page more options

Description
       The  filter allows you to examine a file one screenful of text at a time on a soft-copy terminal.  It normally pauses after each screenful,
       printing --More-- at the bottom of the screen.  If the user then types a carriage return, one more line is displayed.  If the user  presses
       the space bar, another screenful is displayed.

Options
       +linenumber Start up at linenumber.

       +/pattern   Start up two lines before the line containing the regular expression pattern.  The command line options are:

       -c	   Begins  each  page at the top of the screen and erases each line just before it draws on it.  This avoids scrolling the screen,
		   making it easier to read while is writing.  This option is ignored if the terminal does not have the ability to  clear  to  the
		   end of a line.

       -d	   Displays  extended  continuation  prompt at end of each display.  The command prompts the user with the message "Press space to
		   continue, 'q' to quit." at the end of each screenful, and responds to subsequent illegal user input by printing "Press 'h'  for
		   instructions." instead of ringing the bell.	This is useful if more is being used as a filter in some setting, such as a class,
		   where many users may be unsophisticated.

       -f	   Counts logical text lines (does not fold long lines).  This option is recommended if output is being piped  through	since  the
		   latter  may	generate  escape  sequences.  These escape sequences contain characters which would ordinarily occupy screen posi-
		   tions, but which do not print when they are sent to the terminal as part of an escape sequence.  Thus may think that lines  are
		   longer than they actually are, and fold lines erroneously.

       -l	   Ignores  line feeds (CTRL/Ls) and normally, pauses at line feeds.  If this option is not given, pauses after any line that con-
		   tains a ^L, as if the end of a screenful had been reached.  Also, if a file begins with a form  feed,  the  screen  is  cleared
		   before the file is printed.

       -n	   Specifies number of line displays.

       -s	   Squeezes  multiple  blank  lines  from the output, producing only one blank line.  Especially helpful when viewing output, this
		   option maximizes the useful information present on the screen.

       -u	   Ignores all underlining in the data.  If the terminal can perform underlining or has  a  stand-out  mode,  outputs  appropriate
		   escape  sequences  to  enable  underlining or stand-out mode for underlined information in the source file.	The -u option sup-
		   presses this processing.

       If the program is invoked as page, then the screen is cleared before each screenful is printed (but only  if  a	full  screenful  is  being
       printed), and k - 1 rather than k - 2 lines are printed in each screenful, where k is the number of lines the terminal can display.

       The  command looks in the file /etc/termcap to determine terminal characteristics, and to determine the default window size.  On a terminal
       capable of displaying 24 lines, the default window size is 22 lines.

       The command looks in the environment variable MORE to pre-set any flags desired.  For example, if you prefer to view  files  using  the	-c
       mode  of  operation,  the  command  setenv MORE -c or the command sequence MORE='-c' ; export MORE would cause all invocations of including
       invocations by programs such as and to use this mode.  Normally, the user places the command sequence which sets up  the  MORE  environment
       variable in the .cshrc or .profile file.

       If  is  reading from a file, rather than a pipe, then a percentage is displayed along with the --More-- prompt.	This gives the fraction of
       the file (in characters, not lines) that has been read so far.

       Other sequences which may be typed when pauses, and their effects, are as follows (i is an optional integer argument, defaulting to 1) :

       i<space>    Display i more lines, (or another screenful if no argument is given)

       ^D	   Display 11 more lines (a ``scroll'').  If i is given, then the scroll size is set to i.

       d	   Same as ^D (control-D)

       iz	   Same as typing a space except that i, if present, becomes the new window size.

       is	   Skip i lines and print a screenful of lines

       if	   Skip i screenfuls and print a screenful of lines

       ib or i^B   Skip back i screenfuls and print a screenful of lines

       q or Q	   Exit from more.

       =	   Display the current line number.

       v	   Start up the editor at the current line.

       h or ?	   Help command; give a description of all the more commands.

       i/expr	   Search for the i-th occurrence of the regular expression expr.  If there are less than i occurrences of expr, and the input	is
		   a  file  (rather  than a pipe), then the position in the file remains unchanged.  Otherwise, a screenful is displayed, starting
		   two lines before the place where the expression was found.  The user's erase and kill characters may be used to edit the  regu-
		   lar expression.  Erasing back past the first column cancels the search command.  of the last regular expression entered.

       in	   Search for the i-th occurrence

       '	   (single  quote)  Go to the point from which the last search started.  If no search has been performed in the current file, this
		   command goes back to the beginning of the file.

       !command    Invoke a shell with command.  The characters `%' and `!' in "command" are replaced with the current file name and the  previous
		   shell  command  respectively.  If there is no current file name, `%' is not expanded.  The sequences "\%" and "!" are replaced
		   by "%" and "!" respectively.

       i:n	   skip to the i-th next file given in the command line (skips to last file if n doesn't make sense)

       i:p	   Skip to the i-th previous file given in the command line.  If this command is given in the middle of printing out a file,  then
		   goes  back to the beginning of the file. If i doesn't make sense, skips back to the first file.  If is not reading from a file,
		   the bell is rung and nothing else happens.

       :f	   Display the current file name and line number.

       :q or :Q    Exit from

       .	   (dot) Repeat the previous command.

       The commands take effect immediately, that is, it is not necessary to type a carriage return.  Up to the time when  the	command  character
       itself is given, the user may hit the line kill character to cancel the numerical argument being formed.  In addition, the user may hit the
       erase character to redisplay the --More--(xx%) message.

       At any time when output is being sent to the terminal, the user can hit the quit key (normally control-).  The command stops sending  out-
       put,  and displays the usual --More-- prompt.  The user may then enter one of the above commands in the normal manner.  Unfortunately, some
       output is lost when this is done, due to the fact that any characters waiting in the terminal's output queue are flushed when the quit sig-
       nal occurs.

       The  terminal  is set to noecho mode by this program so that the output can be continuous.  What you type not show on your terminal, except
       for the / and !	commands.

       If the standard output is not a teletype, then acts just like except that a header is printed before each file (if there is more than one).

       A sample usage of in previewing output would be
       nroff -ms doc.n | more -s

Files
       /etc/termcap	   Terminal data base
       /usr/lib/more.help  Help file

See Also
       csh(1), man(1), msgs(1), script(1), sh(1), environ(7)

																	   more(1)
All times are GMT -4. The time now is 11:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy