Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing empty lines at the end of a Tab-delimited file Post 302673703 by SirHenry1 on Wednesday 18th of July 2012 09:54:20 AM
Old 07-18-2012
Windows. Using Cygwin.

---------- Post updated at 09:54 AM ---------- Previous update was at 09:11 AM ----------

Quote:
Originally Posted by itkamaraj
using awk

Code:
awk 'NF>=1' input.txt > output.txt

---------- Post updated at 06:19 PM ---------- Previous update was at 06:18 PM ----------

try this

Code:
sed "/ *\t */d" input.txt

what is your OS ?
The sed didn't work, it returned an empty file.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies

2. Shell Programming and Scripting

Removing blanks in a text tab delimited file

Hi Experts I am very new to perl and need to make a script using perl. I would like to remove blanks in a text tab delimited file in in a specfic column range ( colum 21 to column 43) sample input and output shown below : Input: 117 102 650 652 654 656 117 93 95... (3 Replies)
Discussion started by: Faisal Riaz
3 Replies

3. UNIX for Dummies Questions & Answers

Adding EMPTY columns to Tab-delimited txt file

Hi I have a txt file with 4 columns where I need to add 4 empty columns in the middle meaning that I need what is currently column 4 to be column 8 in a new file. The idea is that I have to use the file as input in a program that reads the data in column 1 and 8, so the content of the other... (8 Replies)
Discussion started by: Banni
8 Replies

4. UNIX for Dummies Questions & Answers

Removing trailing lines at the end of a text file

How do you remove trailing empty lines at the end of a text file? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

5. UNIX for Dummies Questions & Answers

tab delimited file that is not tab delimited.

Hi Forum I have a tab delimited file that opens well in Openoffice calc (excel). But when I perform any operation in command line, it reads the file incorrectly. When I 'save As' the same file in office as tab delimited then it works fine. The file that I think is tab delimited is actually... (8 Replies)
Discussion started by: imlearning
8 Replies

6. Shell Programming and Scripting

Help with converting Pipe delimited file to Tab Delimited

I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use cat file | sed 's/|//t/g' The above command substituted "/t" not tab in the place of pipe. Sample file: abc|123|2012-01-30|2012-04-28|xyz have to convert to: abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies

7. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

8. UNIX for Dummies Questions & Answers

Need to convert a pipe delimited text file to tab delimited

Hi, I have a rquirement in unix as below . I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column. ex: Input Text file: 1|A|apple 2|B|bottle excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies

9. Shell Programming and Scripting

Removing tab spaces at the end of each line

I have a file which contains the data lines like below.I want to remove the tab spaces at the end of each line.I have tried with the command sed 's/\+$//' file.but it does not work.Can anyone help me on this? 15022 15022 15022 15022 15022 15022 15023 15023 15023 15023 15023 ... (16 Replies)
Discussion started by: am24
16 Replies

10. UNIX for Beginners Questions & Answers

Replace a column in tab delimited file with column in other tab delimited file,based on match

Hello Everyone.. I want to replace the retail col from FileI with cstp1 col from FileP if the strpno matches in both files FileP.txt ... (2 Replies)
Discussion started by: YogeshG
2 Replies
GIT-STRIPSPACE(1)						    Git Manual							 GIT-STRIPSPACE(1)

NAME
git-stripspace - Remove unnecessary whitespace SYNOPSIS
git stripspace [-s | --strip-comments] < input DESCRIPTION
Clean the input in the manner used by git for text such as commit messages, notes, tags and branch descriptions. With no arguments, this will: o remove trailing whitespace from all lines o collapse multiple consecutive empty lines into one empty line o remove empty lines from the beginning and end of the input o add a missing to the last line if necessary. In the case where the input consists entirely of whitespace characters, no output will be produced. NOTE: This is intended for cleaning metadata, prefer the --whitespace=fix mode of git-apply(1) for correcting whitespace of patches or files in the repository. OPTIONS
-s, --strip-comments Skip and remove all lines starting with #. EXAMPLES
Given the following noisy input with $ indicating the end of a line: |A brief introduction $ | $ |$ |A new paragraph$ |# with a commented-out line $ |explaining lots of stuff.$ |$ |# An old paragraph, also commented-out. $ | $ |The end.$ | $ Use git stripspace with no arguments to obtain: |A brief introduction$ |$ |A new paragraph$ |# with a commented-out line$ |explaining lots of stuff.$ |$ |# An old paragraph, also commented-out.$ |$ |The end.$ Use git stripspace --strip-comments to obtain: |A brief introduction$ |$ |A new paragraph$ |explaining lots of stuff.$ |$ |The end.$ GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-STRIPSPACE(1)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy