LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2014, 08:22 AM   #1
Ejdaha
Member
 
Registered: Jan 2007
Posts: 39

Rep: Reputation: 15
How to differ a string with a text file


Dear all

I have a string with 10 lines and would like to differ it with a text file. Should I read it line by line, trim and differ or is there any simple solution?

thanks beforehane
 
Old 08-28-2014, 08:28 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
the tool diff is able to accept input from stdin, so:
echo $STRING | diff - textfile
can work
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Find Text After String Search in Text File redir Linux - Newbie 12 08-02-2011 04:57 PM
how do i replace a text string in a file with a random string? (with sed etc) steve51184 Linux - Software 16 09-02-2010 12:05 PM
read string after specific string from a text file using C++ programing language badwl24 Programming 5 10-08-2009 06:41 AM
generate new string from a text file walterwaston Programming 2 10-08-2007 03:14 AM
C++ Text File into String Array p2pfire Programming 2 09-18-2007 04:59 AM


All times are GMT -5. The time now is 02:48 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration