Sponsored Content
Top Forums Shell Programming and Scripting avoid open file to check field. Post 302366676 by jimmy_y on Friday 30th of October 2009 05:35:37 AM
Old 10-30-2009
Quote:
Originally Posted by Franklin52
Can you provide a better sample of your input file?
I don't see any "qq" in field 1, assuming the fieldseparator is a comma.
Hi Frank,

the file is:
94,aqqc,62345907,
5,aeec,77,

you can see "qq" is part of line 1, field 1 "aqqc", means when field 1 contains "qq" this word, then print it out.

Thanks
 

10 More Discussions You Might Find Interesting

1. Solaris

How to check no. of files open currently

I'm getting an error "too many files open" # ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) 8192 coredump(blocks) unlimited nofiles(descriptors) 256 memory(kbytes) unlimited # hard limit shows 1024 I would like to know how many files... (1 Reply)
Discussion started by: max_min
1 Replies

2. UNIX for Dummies Questions & Answers

check for "cannot open file"

I have a small script that checks to see if a file exists and that it has data in it. I also need to check if the file can be opened. I had an issue today where the file it checks could not be opened and my script did not catch it. How do I check to see if it cannot be opened? ... (19 Replies)
Discussion started by: ssmith001
19 Replies

3. Shell Programming and Scripting

check for the value of one particular field and give output in a different file

hi i need to check for the value of one particular field : in the output file. the file may contain many such records as below how to ???? *** Throttled with base name + key params! : : -518594328 : les.alarm.LBS12005 : les.alarm.LBS12005 : les : lessrv1 : les : 2328 : 0... (7 Replies)
Discussion started by: aemunathan
7 Replies

4. Shell Programming and Scripting

simplify the script, check field match to value in a file

Hi Everyone, Below is the script, i feel there should be more simple way to do the same output, my one works, but feel not nice. like using index i feel it is slow (image my file is very large), maybe awk can do one line code? Please advice. # cat 1.txt 1 a 2 b 3 cc 4 d # cat 1.pl... (6 Replies)
Discussion started by: jimmy_y
6 Replies

5. Shell Programming and Scripting

How to check field formatting of input file?

Hi, I had input file with below data, abcdefghij;20100903040607;1234567891;GLOBAL; Having values of fields with seperated by semi-colon (;) and ended with line feed (\n). Through shell script, how can I check the field formatting? Thanks in advance. (18 Replies)
Discussion started by: Poonamol
18 Replies

6. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

7. Shell Programming and Scripting

Field value check

used below command to redirect records having P000 in all columns except 4th one in the below files with 3 records , lets say outout in below file is record 1,2 not 3 which is having P000 in the 4th column below commad not working , any help ? awk 'NF>0 { for(i=11;i<=NF;i+=1) if (i!=4 &&... (7 Replies)
Discussion started by: airesh
7 Replies

8. Shell Programming and Scripting

To check if a file is open and in use (logs are being written to it)

Hello Experts, I need to write a shell script to check if a file is open and something is being written to it. I want to know how OS handles it. I checked with lsof command but it is not working. For a test I did this. while true; do echo `date` >>abc.txt; done then I checked lsof |... (5 Replies)
Discussion started by: shekhar_4_u
5 Replies

9. UNIX for Beginners Questions & Answers

How to check if a file is open in editor?

Hi there! I'm developing a program that allows the user to open and edit files using both an editor and the terminal. Once the user has finished editing the file an update is sent to the logbook that compares the file before and after it was edited - this can only be done if the file is closed (I... (23 Replies)
Discussion started by: cherryTango
23 Replies

10. Shell Programming and Scripting

Script to check field value from a file records

I need a script to check the records in a file , if any value match transfer the record in error.txt file. 1- If any of the any field value is NULL(nothing in this field) Record1|Record2|Record3|Record4|Record5|DATE1|DATE2 Example: 11111111|22222222|NULL|12|444|27042018|27042018... (8 Replies)
Discussion started by: vivekn
8 Replies
OPENPAM_READWORD(3)					   BSD Library Functions Manual 				       OPENPAM_READWORD(3)

NAME
openpam_readword -- read a word from a file, respecting shell quoting rules LIBRARY
Pluggable Authentication Module Library (libpam, -lpam) SYNOPSIS
#include <sys/types.h> #include <stdio.h> #include <security/pam_appl.h> #include <security/openpam.h> char * openpam_readword(FILE *f, int *lineno, size_t *lenp); DESCRIPTION
The openpam_readword() function reads the next word from a file, and returns it in a NUL-terminated buffer allocated with malloc(3). A word is a sequence of non-whitespace characters. However, whitespace characters can be included in a word if quoted or escaped according to the following rules: o An unescaped single or double quote introduces a quoted string, which ends when the same quote character is encountered a second time. The quotes themselves are stripped. o Within a single- or double-quoted string, all whitespace characters, including the newline character, are preserved as-is. o Outside a quoted string, a backslash escapes the next character, which is preserved as-is, unless that character is a newline, in which case it is discarded and reading continues at the beginning of the next line as if the backslash and newline had not been there. In all cases, the backslash itself is discarded. o Within a single-quoted string, double quotes and backslashes are preserved as-is. o Within a double-quoted string, a single quote is preserved as-is, and a backslash is preserved as-is unless used to escape a double quote. In addition, if the first non-whitespace character on the line is a hash character (#), the rest of the line is discarded. If a hash charac- ter occurs within a word, however, it is preserved as-is. A backslash at the end of a comment does cause line continuation. If lineno is not NULL, the integer variable it points to is incremented every time a quoted or escaped newline character is read. If lenp is not NULL, the length of the word (after quotes and backslashes have been removed) is stored in the variable it points to. RETURN VALUES
If successful, the openpam_readword() function returns a pointer to a dynamically allocated NUL-terminated string containing the first word encountered on the line. The caller is responsible for releasing the returned buffer by passing it to free(3). If openpam_readword() reaches the end of the line or file before any characters are copied to the word, it returns NULL. In the former case, the newline is pushed back to the file. If openpam_readword() reaches the end of the file while a quote or backslash escape is in effect, it sets errno to EINVAL and returns NULL. IMPLEMENTATION NOTES
The parsing rules are intended to be equivalent to the normal POSIX shell quoting rules. Any discrepancy is a bug and should be reported to the author along with sample input that can be used to reproduce the error. SEE ALSO
openpam_readline(3), openpam_readlinev(3), pam(3) STANDARDS
The openpam_readword() function is an OpenPAM extension. AUTHORS
The openpam_readword() function and this manual page were developed by Dag-Erling Smorgrav <des@des.no>. BSD
September 12, 2014 BSD
All times are GMT -4. The time now is 04:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy