top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you find which processes are using a particular file?

+1 vote
313 views
How do you find which processes are using a particular file?
posted Dec 14, 2015 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
$ fuser file_name

fuser is used to show which processes are using a specified file, file system, or unix socket. Check the following link if need more detail on fuser https://en.wikipedia.org/wiki/Fuser_%28Unix%29

answer Dec 14, 2015 by Salil Agrawal
Similar Questions
0 votes

Data file look:-
6 invoices. Each line represent 1 invoice data. Each column separated by | pipe.

7031982|BALANCE|000000 rent on 23/03/2019|0768|110241|385272|PETTY CASH OLAYAN|VENDOR|BPV2019-3|
7031986|BALANCE|000000|0768|226005|388883|\NOMAN\12\as\|EMPLOYEE|BPV2019-377|
7031986|BALANCE|000000|0768|226011|388883| NOMAN|EMPLOYEE|BPV2019-377|
7031986|BALANCE|000000|0768|240007|388883| NOMAN|EMPLOYEE|BPV2019-377|
7032003|BALANCE|000000|0703|231085|384173|WATER COMPANY|VENDOR|BPV2|
7032003|BALANCE|033511|0768|503000|384173|WäTER COMPANY|VENDOR|BPV2|

Requirement:- I need a bat file which will correct existing file

Some times we get the data like:-
1. |1797 \krv\Fice\AP\klo|
==> this should convert like || (just removing complete data within |)
2. |\krv\Finance\Finance\ap\INS12O|
==> this should convert like || (just removing complete data within |)
3. |\as\sa\1\as\|
==> this should convert like || (just removing complete data within |)
4. |second rent at cal on 23/05/2019|
==> this should convert like |second rent at cal on 23-05-2019| (just replace / with - )
5. | Johannes Märkl Monatsrechnung|
==> this should convert like | Johannes Markl Monatsrechnung | (just replace ä with a )

below is code

    @echo off
setlocal enabledelayedexpansion

(for /f "delims=" %%a in (a30077889.txt) do (
  set "line=%%a"
  set "newline="
  for %%b in ("!line:|=" "!") do (
    set "token=%%~b"
    if "!token:~0,1!"=="\" (
     set "newline=!newline!|"
    ) else (
      set "newline=!newline!%%~b|"
    )
  )
  echo !newline:~0,-1!
))>a.new
REM move /y a.new a30077889.txt
...