Sponsored Content
Full Discussion: Remove Blank Rows
Top Forums Shell Programming and Scripting Remove Blank Rows Post 302478132 by Vinsanity on Tuesday 7th of December 2010 08:32:25 AM
Old 12-07-2010
I got an error when I ran my scripts using
Code:
sed 'g/^ *$/d'

Code:
sed: Function g/^ *$/d cannot be parsed.

But when I double checked my code, it was enclosed in single quotes.

Here is the code:
Code:
src=/var/opt/sapbi/TV/scripts/$1
echo $src
sed 'g/^ *$/d' $src

I tried
grep -v "^ *$" $src but it did not work.
I tried the awk commands but nothing happened to the file.

---------- Post updated at 08:32 AM ---------- Previous update was at 08:30 AM ----------

Just wondering, is there an alternative to Gunzip -f <InpFile>? Because upon checking, when the file is gunzipped, it creates those white spaces in between records. When I try to extract using 7zip, it does not add the white spaces.

Last edited by Scott; 12-07-2010 at 10:04 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Solaris

finding & replacing blank rows/spaces in a file

Can anyone help me find and replace blank rows in a file with a numeric value (ie blankrow=someTxtOrNumValue), the file is over 500,000 rows long so it would need to be the quickest way as I'll need to do this for multiple files...I would be greatfull for any suggestions....thanks sample file:... (2 Replies)
Discussion started by: Gerry405
2 Replies

2. UNIX for Dummies Questions & Answers

Remove blank lines

¿How can i remove blank lines between all lines in a long text file? Example WrongFile.txt : Line 1 Line 2 Line 3 CorrectFile.txt : Line 1 Line 2 Line 3 Thanks in advance :confused: (4 Replies)
Discussion started by: osymad
4 Replies

3. Shell Programming and Scripting

how to delete blank rows in a log file

Help How to delete all blank rows in log file (4 Replies)
Discussion started by: suryanarayana
4 Replies

4. Shell Programming and Scripting

Remove 1st two rows and last 2 rows

Hi All, I need to remove 1st 2 line from head and last 2 line from last. I thought it would be possible by using the Head and tail command. But after i am using it is not possible by it. Example:Input file 1 2 3 4 5 Example: Output file 3 But my head and tail command are not... (12 Replies)
Discussion started by: kam786sim
12 Replies

5. Shell Programming and Scripting

How to remove Blank rows in a csv file

Hi, I need help to remove blank rows at the end of file. Sample data: "Oslo, Symra kino",Oslo,130-7,Symra 1,130-7-91 "Tønsberg, Brygga Kino SF",Tønsberg,202-1,Tønsberg SF 4,202-1-4 ,,,, ,,,, ,,,, ,,,, Expected data: "Oslo, Symra kino",Oslo,130-7,Symra 1,130-7-91 "Tønsberg, Brygga... (6 Replies)
Discussion started by: cnraja
6 Replies

6. Shell Programming and Scripting

How to remove blank lines

Hi, I am facing a problem related to removing blank lines from a text document. Input Error 17-05-2011 11:01:15 VisualSVN Server 2.1 1001 The following information was included with the event: line3 line4 Error 17-05-2011 11:00:25 VisualSVN Server 2.1 ... (13 Replies)
Discussion started by: mayursingru
13 Replies

7. Shell Programming and Scripting

Copying down first row in to all the below blank rows in a .csv file

Hi All, I have many of files(.csv) of the format given below. Date,Name,Location 04/02/2012,A,India ,B,China ,C,USA Like this I have 1000's of rows and many columns in all my files. I need a shell script to copy down the Date(in this example column1) to the next 2 rows below(in the... (8 Replies)
Discussion started by: ks_reddy
8 Replies

8. Shell Programming and Scripting

Perl : blank lines are displayed in the output after deleting few rows from excel

I am working on an assignment to pull all the records from excel sheet programatically and use the data for further calculations. In this process, I first defined 10 records in excel sheet and executed the below code. In the first run it is OK. But after deleting last few rows in excel sheet and... (0 Replies)
Discussion started by: giridhar276
0 Replies

9. Shell Programming and Scripting

Need to remove a selection of rows separated by blank lines

hello, here is an example: 9.07 9.05 0.00 2.28 0.00 0.08 1.93 3.62 10.97 12.03 12.03 0.00 2.73 0.00 0.07 (3 Replies)
Discussion started by: Baron1
3 Replies

10. Shell Programming and Scripting

Converting columns of text to rows, with blank lines

I've spent the past hour trying different things and googling for this solution and cannot find the answer. Found variations of this, but not this exact thing. I have the following text, which is the output from our mainframe. Each field is on a separate line, with a blank line between each... (7 Replies)
Discussion started by: lupin..the..3rd
7 Replies
Tcl_GetInt(3)						      Tcl Library Procedures						     Tcl_GetInt(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean - convert from string to integer, double, or boolean SYNOPSIS
#include <tcl.h> int Tcl_GetInt(interp, src, intPtr) int Tcl_GetDouble(interp, src, doublePtr) int Tcl_GetBoolean(interp, src, boolPtr) ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for error reporting. const char *src (in) Textual value to be converted. int *intPtr (out) Points to place to store integer value converted from src. double *doublePtr (out) Points to place to store double-precision floating-point value converted from src. int *boolPtr (out) Points to place to store boolean value (0 or 1) converted from src. _________________________________________________________________ DESCRIPTION
These procedures convert from strings to integers or double-precision floating-point values or booleans (represented as 0- or 1-valued integers). Each of the procedures takes a src argument, converts it to an internal form of a particular type, and stores the converted value at the location indicated by the procedure's third argument. If all goes well, each of the procedures returns TCL_OK. If src does not have the proper syntax for the desired type then TCL_ERROR is returned, an error message is left in the interpreter's result, and noth- ing is stored at *intPtr or *doublePtr or *boolPtr. Tcl_GetInt expects src to consist of a collection of integer digits, optionally signed and optionally preceded by white space. If the first two characters of src after the optional white space and sign are "0x" then src is expected to be in hexadecimal form; otherwise, if the first such character is "0" then src is expected to be in octal form; otherwise, src is expected to be in decimal form. Tcl_GetDouble expects src to consist of a floating-point number, which is: white space; a sign; a sequence of digits; a decimal point; a sequence of digits; the letter "e"; a signed decimal exponent; and more white space. Any of the fields may be omitted, except that the digits either before or after the decimal point must be present and if the "e" is present then it must be followed by the exponent number. Tcl_GetBoolean expects src to specify a boolean value. If src is any of 0, false, no, or off, then Tcl_GetBoolean stores a zero value at *boolPtr. If src is any of 1, true, yes, or on, then 1 is stored at *boolPtr. Any of these values may be abbreviated, and upper-case spellings are also acceptable. KEYWORDS
boolean, conversion, double, floating-point, integer Tcl Tcl_GetInt(3)
All times are GMT -4. The time now is 07:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy