Sponsored Content
Top Forums Shell Programming and Scripting To check Blank Lines, Blank Records and Junk Characters in a File Post 302943382 by chatwithsaurav on Friday 8th of May 2015 03:33:51 AM
Old 05-08-2015
Hi Don..

Apologies for not "specifying" correctly. Smilie

1>Well Blank Line would mean spaces and tabs only.
2>Blank records in between "|" delimiter means that the column is NULL (blank as of now) . User has forgot to place the data there.
Example ABCDEFGH|"NULL"|M|"NULL"
"NULL"|XYZABNH|"NULL"|4567344
3>Junk Characters would mean characters other that alphabets or numerical or special characters. Something which is not understandable.
Example ¢'Á|äÃ



" KJHSAJKHHJJ" or "ABCDEFGH" are examples which I have used instead of proper names.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting the blank line in a file and counting the characters....

Hi, I am trying to do two things in my script. I will really appreciate any help in this regards. Is there a way to delete a last line from a pipe delimited flat file if the last line is blank. If the line is not blank then do nothing..... Is there a way to count a word that are starting... (4 Replies)
Discussion started by: rkumar28
4 Replies

2. Shell Programming and Scripting

how to check weather file is blank or not?

Dear All I want to do following task. Kindly suggest. In my script every hour one file is genarated. say xyz.txt. Now if this file contain some data then i want to do task A and if file is blank then i want to do nothing. Kindly help me to do this. regards jaydeep (5 Replies)
Discussion started by: jaydeep_sadaria
5 Replies

3. Shell Programming and Scripting

Can't remove blank lines from a file

Hi Guys, I have been trying to remove blank lines from a file with no success. I tried using all the following options on the file: tr -s '\n' < abc.txt grep -v "^$" abc.txt sed '/^$/d' abc.txt sed '/./!d' abc.txt awk '/./' abc.txt The file is a text file. (11 Replies)
Discussion started by: npatwardhan
11 Replies

4. Shell Programming and Scripting

Delete blank lines, if blank lines are more than one using shell

Hi, Consider a file named "testfile" The contents of file are as below first line added for test second line added for test third line added for test fourth line added for test fifth line added for test (5 Replies)
Discussion started by: anil8103
5 Replies

5. Shell Programming and Scripting

Delete blank lines in a file

Hi All, I have a file and I need to delete the lines that are blank and is starting with some characters below. Something like below: Regular Ascii File: Line1: AGODA1 BUSAN||SK Lord Beach 4/6/2012 4/7/2012 68060 Line2: AGODA2 BUSAN||SK Beach Hotel 4/6/2012 4/7/2012 610200 Line3: ... (4 Replies)
Discussion started by: rkumar28
4 Replies

6. Shell Programming and Scripting

Reform Lines in File without blank lines and spaces

Hello All, I have a file with data as below. Each line consists of 21 fields. I am not able to load them back to the database. 50733339,"834","834 ","005010X279A1","N","Y","007977163","0001 ",30,"2110D ","EB ","EB007 ","2 ","Conditional Required Data Element Miss ing... (3 Replies)
Discussion started by: Praveenkulkarni
3 Replies

7. Shell Programming and Scripting

Removing blank lines from a file

Hi All, How do i remove continuos blank lines from a file. I have a file with data: abc; def; ghi; jkl; mno; pqr; In the above file, there are two blank lines. I want to remove, one out of them. My output should look like: (2 Replies)
Discussion started by: raosr020
2 Replies

8. Shell Programming and Scripting

How to check if the file is empty or has blank space.?

Hi, I am using KSH. I am trying to check if the output file is empty or not. I tried with ] but what i see is my file is empty but still manages to have a size of 1 instead of 0. But my file doesnot have anything its empty. I am not sure how to check this. can any one help? (10 Replies)
Discussion started by: Sharma331
10 Replies

9. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

Hi Gurus, Somebody can say me how to delete blank spaces and blank lines in a file unix, please. Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies

10. Shell Programming and Scripting

Script to find blank records in a file except for few columns

I have a file with the following format: X|High|2|GIC|DM||XHM|||6 Months X|Moderate|2|GIC|DM||XHM|||6 Months X|High|2|GCM|DM||XSF|||6 Months X|Med|2|GCM|DM||XSF|||6 Here there are ten columns but I need to print rows having blank records in any of the rows (except for 6th,8th and 9th... (10 Replies)
Discussion started by: chatwithsaurav
10 Replies
priv_str_to_set(3)					     Library Functions Manual						priv_str_to_set(3)

NAME
priv_str_to_set(), priv_set_to_str() - privilege name to set conversion function SYNOPSIS
Parameters priv_list The list of privilege names, passed as a string, separated by one or more characters from delimiter. It may also contain the compound privileges (basic, basicroot, and policy). delimiter Separates the privileges in priv_list. index_ptr If an error occurs while parsing the list of privilege names, the pointer pointed to by index_ptr is set to point to the remainder of the string after the error occurred, so long as index_ptr is not a NULL pointer. delimiter Separates the individual privilege names by any of the specified characters. If delimiter is a NULL character, the default delimiter of comma is used. flag Bit mask with the following bit positions defined: Exactly one of the two flags must be passed. When flag is the resulting string uses the compound privileges and to arrive at a short representation. priv_vec Specifies privilege set. DESCRIPTION
priv_str_to_set Conversion converts a list of privilege names to a privilege set. priv_list is a string consisting of privilege names and/or compound privileges. The individual elements in the string are separated by one or more characters of delimiter . Any privilege in the list priv_list can be optionally preceded by an exclamation mark to be interpreted as removal. For example, means all privileges in the compound privilege except the privilege. The string is case-insensitive. prefix is optional to a privilege name. For example, and all have the same meaning. priv_list is interpreted left to right, so the string is the same as an empty list of privileges, while is the same as For a list of valid privileges (both individual privileges and compound privileges), see privileges(5). priv_set_to_str Conversion converts a privilege set to a string of privilege names separated by the character specified by delimiter . RETURN VALUE
and return the following values: pointer Successful completions. Returns a non-null pointer. The caller of is responsible for freeing the result using the The caller of is responsible for freeing the result using the NULL pointer Function failed. Returns a null pointer and sets to indicate the error . ERRORS
If any of the following conditions occur, the functions fail and set Cannot allocate enough memory for the given data. One or more arguments are invalid. EXAMPLES
#include <stdio.h> #include <sys/types.h> #include <sys/privileges.h> #define priv_list "PRIV_CHOWN,PRIV_CHROOT,PRIV_DACREAD" main() { char *index; priv_set_t * priv_vector; if ( (priv_vector = priv_str_to_set( priv_list, NULL, &index)) == NULL ) { perror("priv_str_to_set Failed"); if (index) printf("Invalid privilege name starting at %s ", index); exit(1); } printf("The privileges in the given privilege vector are %s ", priv_set_to_str( priv_vector, NULL, PRIV_STR_SHORT) ); } DEPENDENCIES
and are both part of the library. SEE ALSO
privset_free(3), privileges(5). priv_str_to_set(3)
All times are GMT -4. The time now is 03:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy