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 06-23-2015, 05:52 AM   #1
Aomine Daiki
LQ Newbie
 
Registered: Jun 2015
Location: Tunisia
Posts: 10

Rep: Reputation: Disabled
Remove double characters


in a text file I have a lot of double characters how I can remove all.
Expl: if i have:

Code:
abcddef ghijkk lmenoo ()/\\ +-==
i need to have a result like this:

Code:
abcdef ghijk lmeno ()/\ +-=
 
Old 06-23-2015, 06:09 AM   #2
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
Code:
man fopen
man getchar
man putchar
are your friends.
 
Old 06-23-2015, 06:19 AM   #3
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
With this InFile ...
Code:
abcddef ghijkk lmenoo ()/\\ +-==
hooww noww bbrownn ccow
... this sed ...
Code:
sed 's/\(.\)\1/\1/g' $InFile >$OutFile
... produced this OutFile ...
Code:
abcdef ghijk lmeno ()/\ +-=
how now brown cow
Daniel B. Martin
 
2 members found this post helpful.
Old 06-23-2015, 06:22 AM   #4
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
With this InFile ...
Code:
abcddef ghijkk lmenoo ()/\\ +-==
hooww noww bbrownn ccow
... this tr ...
Code:
tr -s "[:graph:]" <$InFile >$OutFile
... produced this OutFile ...
Code:
abcdef ghijk lmeno ()/\ +-=
how now brown cow
Daniel B. Martin

Last edited by danielbmartin; 06-23-2015 at 06:30 AM. Reason: Correction
 
1 members found this post helpful.
  


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
[SOLVED] Remove Characters From Within Variable dnoob Programming 13 02-21-2011 01:12 AM
remove particular characters using sed dsids Linux - Software 7 12-14-2010 12:10 AM
How to convert characters with notations into double Jane2008 Linux - Newbie 1 02-04-2009 03:13 PM
tcsh double click text selection - extra characters Kyoseki Linux - Desktop 4 10-17-2006 12:03 AM
remove characters in c alaios Programming 2 07-10-2005 10:10 AM

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

All times are GMT -5. The time now is 11:27 AM.

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