LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-07-2010, 01:51 AM   #1
Algis
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Rep: Reputation: 1
Bash. Remove from text table


Hi. Let's say i have a table in a text file.
How can i remove from that table for example "SLS= " if the value is empty? Is it possible to do it in bash awk or sed?
Sorry for my english.

http://dl.dropbox.com/u/4110369/test.txt

10.25 SLS=* G.V.=* BBU=122 G.V.=14
10.28 SLS=196 G.V.=198 BBU=* G.V.=*
10.08 U.T.=* I.M=--
10.15 U.T.=-0.522 I.M=*
 
Old 11-07-2010, 02:13 AM   #2
Algis
LQ Newbie
 
Registered: Nov 2010
Posts: 8

Original Poster
Rep: Reputation: 1
Solved by converting to other encoding and:
Code:
cat /tmp/whattoremove.txt | while read line; do sed -i "s|$line|g" /tmp/test.txt; done
Inside whattoremove.txt: SLS= |
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash text to variable accessing individual text lines patolfo Programming 11 05-11-2010 10:21 AM
how to read data from text file and output into a table? j123 Linux - Newbie 26 04-15-2010 12:58 AM
How to remove string in the text file ? Bash script dlugasx Linux - Server 9 06-05-2009 11:40 AM
bash script to create text in a file or replace value of text if already exists knightto Linux - Newbie 5 09-10-2008 11:13 PM
how to change some text of a certain line of a text file with bash and *nix scripting alred Programming 6 07-10-2006 11:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration