|
|
|
|
UGU: Unix Guru Universe - Unix Tip #4471- June 8, 2023
- Home : Help
: Today's Tip
Unix Tip #4471- June 8, 2023
ONE STEP AT A TIME WITH !!
For example using C shell I want
to edit a handful of files that
contain the string "ProcessInput"
in my current directory.
Step 1:
Find the files which uses "ProcessInput"
% grep "ProcessInput" *.c
a.c:ProcessInput ( int a )
b.c:Description : ProcessInput is used to process the input
given by the user
b.c:Call ProcessInput to perform ...
c.c:val = ProcessInput(2) ;
c.c:val = ProcessInput(3) ;
Step 2:
Extract the filenames on the left.
$!! | awk -F: '{print $1}'
a.c
b.c
b.c
c.c
c.c
step 3:
Remove the duplicates
!! | sort -u
Step 4:
Now edit it !
vi `!!`
which runs vi `grep "ProcessInput" *.c | awk -F: '{print $1}'
| sort -u`
This tip generously supported by: desikann@future.futsoft.com
NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.
LAST 5 TIPS
4470
- PRINTING WITH NO SPACE
4469
- To grab all hidden files
4468
- SAVE A COPY
4467
- KEEPING PEOPLE OUT
4466
- STRING STRIPPING
I want to
SUBSCRIBE
and get a UGU Tip everyday.
I want to
UNSUBSCRIBE
and NOT get a UGU Tip everyday.
If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
|
|
|
Copyright 1994-2024 Unix Guru Universe |
|
|
|
|