How read and replace Microsoft word in Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How read and replace Microsoft word in Unix
# 1  
Old 02-22-2010
How read and replace Microsoft word in Unix

Hi,

I'm newbie in UNIX. I would like to ask how to read a file which in Microsoft word format? Inside the doc file is just a few sentences . "It is a text. Help me with it". and I would like to replace the the word of text to message.

I was trying with this

Code:
for i in `find . -type f -name '*.doc' -print`
> do
> sed 's/text/message/g'<$i>$$
> mv $$ $i
> done

perl -e "s/text/message/g;" -pi $(find /home/test.doc -type f)

But it is failed and wrong.

Please give me some advices on it.

Thanks for helping.

Regards,
Tee

Last edited by pludi; 02-23-2010 at 01:52 AM.. Reason: code tags, please...
# 2  
Old 02-23-2010
Microsoft Word is a binary file not an ascii afaik. You cannot use any text processing utility on that
# 3  
Old 02-23-2010
Quote:
Originally Posted by royalibrahim
Microsoft Word is a binary file not an ascii afaik. You cannot use any text processing utility on that
OpenOffice is a stable & powerful one, which can be used for this purpose.
# 4  
Old 02-23-2010
Is that any way to convert the microsoft word which is binary to ASCII and do the read and replace?

Please give me some advices.
# 5  
Old 02-23-2010
Quote:
Originally Posted by tee
Is that any way to convert the microsoft word which is binary to ASCII and do the read and replace?

Please give me some advices.
Open in OpenOffice Writer, click on "File"->"Save As". In the file type drop-down select Text, enter a name, and click "Save". It'll ask you if you're sure since you'll lose all formatting, click "Yes" here.

Pretty sure there's a similar way in MS Office too.
# 6  
Old 02-23-2010
Understand that microsoft word (almost every word processing software ) uses many formatting characters which is quite different from our ascii to store and process the data , so please dont try to do some replace operations blindly , you may lose your file.
# 7  
Old 02-23-2010
Thanks for your advise. But the problem is, if i have more than 100 doc files in the server. And i need to read and replace those files that contain the word of text, and replace it to message. So i cant choose the way that save as new file in open office. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read contains within { and replace the word

Hello Team, I am looking for help to read contains from { } and replace the word. basically, I need to use this for nagios configuration file where each host/service define within {}. I want script or syntax to which read first word/line from {} and replace the desire word within that {}. ... (5 Replies)
Discussion started by: ghpradeep
5 Replies

2. UNIX for Dummies Questions & Answers

Read microsoft excel in Unix

Hey guys, Can we read a microsoft excel spreadsheet in Unix / linux. If so, what are the steps to be followed? I know we can convert the excel workbook as a CSV and then read it in unix. Are there any other direct methods? thanks prasan81 (2 Replies)
Discussion started by: prasan81
2 Replies

3. UNIX for Dummies Questions & Answers

How to conver a unix output file to Microsoft word document

Hi, I'am are working on Unix platform. It requires for me to present the certain unix files in Microsoft word. Is conversion of a Unix ".out" file to Microsoft word feasible????? Kindly Let me know on this... Thanks in Advance, Divya (1 Reply)
Discussion started by: divyacl
1 Replies
Login or Register to Ask a Question