Friday, December 02, 2011

Grep for IP addresses

#grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'  logfile


Its easy if we put it as an alias in $HOME/.bashrc file. 


alias ipgrep="grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'"

Tuesday, November 22, 2011

Thursday, November 17, 2011

Kubuntu 11.10 - Dissapointed

Yeah. I love Kubuntu. But after the recent installation of Kubuntu 11.10, it's not a nice experience. I have used beta versions that might be better than this. It's being more than a month after it was released. And I still have huge loads of new issues and regressions. Right now my laptop fans are running on full speed without any process actively using the CPU, Mobile Broadband dongle doesn't work properly, Would be able to see random crashes while shutting down, long delays at  starting ups and shutting down, Making permanent entries in classic menu wasn't working are few of the problems. 

I accept the developers work hard on this and full credit should go for them for putting this up for free. But with this rapid release cycles, I think Kubuntu can't make a stable Operating system, and that's bad. Is it better to go for stability over features. Or should I select another OS which suits me.

Yeah... With all my love towards Kubuntu, I think I should start contributing in some how and should start reporting bugs at least.  Lets see how this can be done...

Wednesday, September 07, 2011

Convert .doc to .pdf in command line using Libreoffice

The command would be 
 libreoffice --headless --convert-to pdf test.doc

test.doc is the document which we needed to be converted into pdf and this command will produce test.pdf in the same directory since we haven't specified a output directory.

Apparently this can be used to convert many more types of documents. For example converting a pdf file into odt would work too. 

libreoffice --headless --convert-to odt test.pdf

Its interesting to have a look at the command line options provided by the Libreoffice

LibreOffice 3.6

Usage: soffice [options] [documents...]

Options:
--minimized    keep startup bitmap minimized.
--invisible    no startup screen, no default document and no UI.
--norestore    suppress restart/restore after fatal errors.
--quickstart   starts the quickstart service
--nologo       don't show startup screen.
--nolockcheck  don't check for remote instances using the installation
--nodefault    don't start with an empty document
--headless     like invisible but no userinteraction at all.
--help/-h/-?   show this message and exit.
--version      display the version information.
--writer       create new text document.
--calc         create new spreadsheet document.
--draw         create new drawing.
--impress      create new presentation.
--base         create new database.
--math         create new formula.
--global       create new global document.
--web          create new HTML document.
-o            open documents regardless whether they are templates or not.
-n            always open documents as new files (use as template).

--display
      Specify X-Display to use in Unix/X11 versions.
-p
      print the specified documents on the default printer.
--pt
      print the specified documents on the specified printer.
--view
      open the specified documents in viewer-(readonly-)mode.
--show
      open the specified presentation and start it immediately
--accept=
      Specify an UNO connect-string to create an UNO acceptor through which
      other programs can connect to access the API
--unaccept=
      Close an acceptor that was created with -accept=
      Use -unnaccept=all to close all open acceptors
--infilter=
      Force an input filter type if possible
      Eg. -infilter="Calc Office Open XML"
--convert-to output_file_extension[:output_filter_name] [-outdir ouput_dir] files
      Batch convert files.
      If -outdir is not specified then current working dir is used as output_dir.
      Eg. -convert-to pdf *.doc
          -convert-to pdf:writer_pdf_Export -outdir /home/user *.doc
--print-to-file [-printer-name printer_name] [-outdir ouput_dir] files
      Batch print files to file.
      If -outdir is not specified then current working dir is used as output_dir.
      Eg. -print-to-file *.doc
          -print-to-file -printer-name nasty_lowres_printer -outdir /home/user *.doc

Remaining arguments will be treated as filenames or URLs of documents to open.

PS :-
As pointed out by Martin(read comments),  Looks like the above command will not work if the libreoffice application is already running. Thanks for point it out Martin. Does anybody know a work around?