Sponsored Content
Full Discussion: [vi]:%s / P/P/ ?
Top Forums UNIX for Dummies Questions & Answers [vi]:%s / P/P/ ? Post 74427 by vgersh99 on Thursday 9th of June 2005 02:10:24 PM
Old 06-09-2005
Quote:
Originally Posted by yongho
Could anyone tell me what the second line in this block of code in this here-document does.

vi /tmp/irfelogls2.txt <<!
:%s / P/P/
:wq!
!

1. Opens file.
2. Performs command ":%s / P/P/"
3. Write, and force-quit the editor.

Hm..

I think what it's doing is, searching for a regex of " P" and then replacing it with just a "P".. correct?

Edit: Ehh.. sorry... what a waste of a post, I think I answered my own question.
ehhhh.... almost
it replaces the FIRST occurance ' P' with 'P' on every line of a file.
In order to replace ALL the occurances on all the lines:
:%s / P/P/g
 
i-ls(1) 						      General Commands Manual							   i-ls(1)

NAME
i-ls - display file stat and checksum information for files SYNOPSIS
i-ls [-s] filename i-ls [-s] dirname Specify a filename for i-ls to examine, or specify a directory with dirname to examine all the files in the directory. -s Do not show/calculate checksums for all regular files. DESCRIPTION
The integrit system detects intrusion by detecting when trusted files have been altered. integrit records information about files in a database. i-ls allows the user to see that information for live files. The output syntax is the same as that of integrit. EXAMPLES
i-ls /tmp/foo.txt shows file stat attributes for the file, "/tmp/foo.txt". i-ls /tmp shows file stat attributes for all files in the directory, "/tmp". i-ls -s /tmp shows file stat attributes for all files in the directory, "/tmp", also including also checksums for all regular files. AUTHOR
Ed L Cashin <ecashin@users.sourceforge.net> See the integrit web site for up to date releases and information at http://integrit.sourceforge.net/ SEE ALSO
Integrit File Verification System Manual (info), lstat(2) Version 4.1 Jul 27, 2001 i-ls(1)
All times are GMT -4. The time now is 08:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy