Tuesday 1 April 2014

Linux: Delete all contents of file by only a command in vi editor

To clear the contents of a file is opening. Let's try folow the following command.

           :1,$d

Other basic useful command :
* Create a file
vi filename
* To exit vi and save changes:
         ZZ   or  :wq
* To exit vi without saving changes:
         :q!
* To edit file content :
         i
* Deleting Text :

*xdelete single character under cursor
 Nxdelete N characters, starting with character under cursor
 dwdelete the single word beginning with character under cursor
 dNwdelete N words beginning with character under cursor;
  e.g., d5w deletes 5 words
 Ddelete the remainder of the line, starting with current cursor position
*dddelete entire current line
 Ndd or dNddelete N lines, beginning with the current line;
  e.g., 5dd deletes 5 lines

* Searching Text:

 /stringsearch forward for occurrence of string in text
 ?stringsearch backward for occurrence of string in text
 nmove to next occurrence of search string
 Nmove to next occurrence of search string in opposite direction
* Screen Manipulation:

 ^fmove forward one screen
 ^bmove backward one screen
 ^dmove down (forward) one half screen
 ^umove up (back) one half screen
 ^lredraws the screen
 ^rredraws the screen, removing deleted lines

Excel: How to remove VBA password from excel file

If you want to remove VBA password protect excel file without password, please follow the following guidelines.

Step by step :
  1. Download a HEX editor (HxD Hex Editor)
  2. Open xls/xlsx file and Save As xls. Do this even if the file is xls, just to be sure
  3. Open xls file with a hex editor
  4. Search for DPB
  5. Replace DPB to DPx (Note: the editor overrides, not inserts. So pay attention)
  6. Save file
  7. Open file in Excel
  8. Click "Yes" if you get any message box. There will be a few
  9. Click Alt + F11
  10. Click Tools -> [Project Name] Properties
  11. Click Protection
  12. Enter a new password twice
  13. Save
  14. Close and open the file again
  15. Type your new password to get to the required information.