nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Help

This is a discussion on Help within the Shell scripting forums, part of the Development/Scripting category; Is it possible to find a file I have written in Open office wordprocessor+ I have Mandrake Linux 10.0 The ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 09-08-2005, 02:54 AM
Gorky
Guest
 
Posts: n/a
Default Help

Is it possible to find a file I have written in Open office wordprocessor+ I have Mandrake Linux 10.0


The following does find files only written in the editor vi.
$find ./ -name '' name of the file'' -print
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-08-2005, 03:38 AM
kavi
Guest
 
Posts: n/a
Default

i opened my word processor and created a file tt. on saving it by default it came with a .abw extension.
then i used
Code:
find / -name tt* -type f -name
i got many files.........i scrolled up to find my file in /home/user/tt.abw

then i changed the command to
Code:
find /home -name tt* -type f -name
it just came up with two file including the tt.abw
does this help u?
Reply With Quote
  #3 (permalink)  
Old 09-08-2005, 06:13 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Well kavi is right, however you should try following too:
Open Office file extension is SXW so to find out all .sxw file command would be:
Code:
find / -iname "*.sxw"
Hey kavi, you are doing good job why don't u create account?
Reply With Quote
  #4 (permalink)  
Old 09-09-2005, 02:00 AM
Guest
 
Posts: n/a
Default

Thanks everybody

It worked fine.

I want to use the ' grep ' command to fine a string in one of the files written in Open Office.
It worked fine on all the files I wrote using vi editor.

Look at the following file.

/home/ka/Documents/Cisco questions and answers.sxw

I want to use the grep command to find a word like 'for' or ' of ' in the above file. Is it possible?

It worked fine for the files written in vi editor.

Your help is deeply appreciated.
Reply With Quote
  #5 (permalink)  
Old 09-09-2005, 06:11 PM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 154
Rep Power: 4
sweta will become famous soon enough
Default

Well I think grep works with text file only and not binary data files. May be try out desktop search provided by KDE or Beagle desktop Searching tool.
Reply With Quote
  #6 (permalink)  
Old 09-09-2005, 10:40 PM
Gorky
Guest
 
Posts: n/a
Default

Thanks sweta for the reply.

Even the files which has the 'html' endings could be traced by grep family of commands. Look at the following:

[ka@c83-250-89-72 ka]$ fgrep title myfile1.html
<title>My homepage</title>
[ka@c83-250-89-72 ka]$

[ I looked for the word 'title' in a file called ' myfile.html ' .]

I just want to know the problem here. Why can't it penetrate a letter written in the wordprocessor, OpenOffice?
Reply With Quote
  #7 (permalink)  
Old 09-10-2005, 02:58 AM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Quote:
Originally Posted by Gorky
I just want to know the problem here. Why can't it penetrate a letter written in the wordprocessor, OpenOffice?
Short answer grep can't find the text in binary format. OpenOffice saves file in binary format for optimization and saving of disk space. You can save as your files as html or even text format so that you can do a search using grep.

Long answer ... Okay let us try to understand OpenOffice file format. First it uses XML to store everything and your file divided into different files. But you always see one file called foo.sxw. This file is basically nothing but zip file containing all other .XML files. So just use unzip command to open them, for example if your file is foo.sxw:

Code:
mkdir /tmp/test
cp foo.sxw /tmp/test
cd /tmp/test
unzip foo.sxw
And you should 3-4 different xml file. Next content.xml contains your actual data written in text format as well as XML codes. So just grep into it:

grep -iE “text-to-search” content.xml

In other words you can find what you wanna if you automate this procedure (unzip file and grep it etc) via shell or perl script you can do the job.
Reply With Quote
  #8 (permalink)  
Old 09-10-2005, 07:03 AM
Junior Member
User
 
Join Date: Sep 2005
Posts: 24
Rep Power: 0
kavi
Default

Quote:
Originally Posted by monk
Well kavi is right, however you should try following too:
Open Office file extension is SXW so to find out all .sxw file command would be:
Code:
find / -iname "*.sxw"
Hey kavi, you are doing good job why don't u create account?
monk, i did create an account. hope u recognized me. I am the guest with 'content of the file' problem.
it was just ur inspiration that i learnt a bit of how things happen with shell. thanx man.....
Reply With Quote
  #9 (permalink)  
Old 09-10-2005, 03:50 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 482
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

Welcome kavi. Yup I did recognized you Hope we all learn something by helping each other
Reply With Quote
  #10 (permalink)  
Old 09-13-2005, 02:54 AM
Gorky
Guest
 
Posts: n/a
Default

Thanks for the replies.


What is the difference between the two following commands?

find / -iname "*.sxw"

find / ~iname "*.sxw"
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +5.5. The time now is 06:27 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36