Sponsored Content
Top Forums Shell Programming and Scripting Tried many options but unable to delete blank lines from text file Post 303000993 by uuuunnnn on Monday 24th of July 2017 07:49:58 PM
Old 07-24-2017
Thanks everyone.

Yes the issue was that I was copying the values from windows to unix and carriage return was entered. As suggested I entered the values in unix and used

Code:
sed '/^$/d' temp.hash.txt > temp.hash.out

It worked fine.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

regex to delete multiple blank lines in a file?

can't figure out a way to delete multiple empty lines but keep single empty lines in a file, file is like this #cat file 1 2 3 4 5 6 - What I want is 1 2 (6 Replies)
Discussion started by: fedora
6 Replies

2. Shell Programming and Scripting

Delete blank lines at the end of file

I am attempting to delete blank lines in my file and I've used this command: sed '/^$/d' $file > $file.fixed all this seems to do is copy the file and not delete the blank lines located at the end of the file. Any assistance would be greatly appreciated. (3 Replies)
Discussion started by: TL56
3 Replies

3. UNIX for Dummies Questions & Answers

delete blank lines from a file

can anyone show me how to delete blank lines from a file. thanks in advance (2 Replies)
Discussion started by: sachin.gangadha
2 Replies

4. Shell Programming and Scripting

Delete a block of text delimited by blank lines when pattern is found

I have a file which contains blocks of text - each block is a multi-lines text delimited by blank lines eg. <blank line> several lines of text ... pattern found on this line several more lines of text ... <blank line> How do you delete the block of text (including the blank lines) when... (17 Replies)
Discussion started by: gleu
17 Replies

5. UNIX for Dummies Questions & Answers

Remove blank lines and comments from text file

Hi, I am using BASH. How can I remove any lines in a text file that are either blank or begin with a # (ie. comments)? Thanks in advance. Mike (3 Replies)
Discussion started by: msb65
3 Replies

6. Shell Programming and Scripting

Delete blank lines from a file

Hi, I want to use diff to compare two files in a Perl file. But one of the files has some blank lines at the end. So I want to delete the blank lines from the file firstly and then use diff to compare them. But I dont know how to delete the blank lines from the files. Meanwhile, the system is... (5 Replies)
Discussion started by: Damon_Qu
5 Replies

7. 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

8. Shell Programming and Scripting

Delete the last empty/blank line of the text file

Hi All, I have a file.txt which seems like having three lines. wc -l file.txt 3 file.txt In fact, once it is open in text editor, this file has four lines where the last line is empty. how can i delete this last empty line of the file.txt? I tried the codes below so far but they... (6 Replies)
Discussion started by: senayasma
6 Replies

9. 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

10. 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
HASH(3) 						   BSD Library Functions Manual 						   HASH(3)

NAME
hash -- hash database access method SYNOPSIS
#include <sys/types.h> #include <db.h> DESCRIPTION
The routine dbopen() is the library interface to database files. One of the supported file formats is hash files. The general description of the database access methods is in dbopen(3), this manual page describes only the hash specific information. The hash data structure is an extensible, dynamic hashing scheme. The access method specific data structure provided to dbopen() is defined in the <db.h> include file as follows: typedef struct { u_int bsize; u_int ffactor; u_int nelem; u_int cachesize; u_int32_t (*hash)(const void *, size_t); int lorder; } HASHINFO; The elements of this structure are as follows: bsize The bsize element defines the hash table bucket size, and is, by default, 256 bytes. It may be preferable to increase the page size for disk-resident tables and tables with large data items. ffactor The ffactor element indicates a desired density within the hash table. It is an approximation of the number of keys allowed to accu- mulate in any one bucket, determining when the hash table grows or shrinks. The default value is 8. nelem The nelem element is an estimate of the final size of the hash table. If not set or set too low, hash tables will expand gracefully as keys are entered, although a slight performance degradation may be noticed. The default value is 1. cachesize A suggested maximum size, in bytes, of the memory cache. This value is only advisory, and the access method will allocate more mem- ory rather than fail. hash The hash element is a user defined hash function. Since no hash function performs equally well on all possible data, the user may find that the built-in hash function does poorly on a particular data set. User specified hash functions must take two arguments (a pointer to a byte string and a length) and return a 32-bit quantity to be used as the hash value. lorder The byte order for integers in the stored database metadata. The number should represent the order as an integer; for example, big endian order would be the number 4,321. If lorder is 0 (no order is specified) the current host order is used. If the file already exists, the specified value is ignored and the value specified when the tree was created is used. If the file already exists (and the O_TRUNC flag is not specified), the values specified for the bsize, ffactor, lorder and nelem arguments are ignored and the values specified when the tree was created are used. If a hash function is specified, hash_open() will attempt to determine if the hash function specified is the same as the one with which the database was created, and will fail if it is not. Backward compatible interfaces to the older dbm and ndbm routines are provided, however these interfaces are not compatible with previous file formats. ERRORS
The hash access method routines may fail and set errno for any of the errors specified for the library routine dbopen(3). SEE ALSO
btree(3), dbopen(3), mpool(3), recno(3) Per-Ake Larson, Dynamic Hash Tables, Communications of the ACM, April 1988. Margo Seltzer, A New Hash Package for UNIX, USENIX Proceedings, Winter 1991. BUGS
Only big and little endian byte order is supported. BSD
August 18, 1994 BSD
All times are GMT -4. The time now is 07:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy