To find a file in unix
- ironmaiden
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 83
- Thank you received: 0
18 years 2 weeks ago #2310
by ironmaiden
Common Unix commands used was created by ironmaiden
Hi all,
I am starting this post because we can maintain a list of common unix commands used by GLOBUS professionals. I know many of them need various commands but things like compress, tar, gzip are the most commonly used unix commands. Please reply with as much unix command as possible. Also i would request ppl to avoid commands like ls -l*,rm -R...
Thanks in advance.
Best Regards
IRON
_________________
NJOY LIFE TO THE FULLEST
I am starting this post because we can maintain a list of common unix commands used by GLOBUS professionals. I know many of them need various commands but things like compress, tar, gzip are the most commonly used unix commands. Please reply with as much unix command as possible. Also i would request ppl to avoid commands like ls -l*,rm -R...
Thanks in advance.
Best Regards
IRON
_________________
NJOY LIFE TO THE FULLEST
Please Log in or Create an account to join the conversation.
- malai
- Offline
- Platinum Member
Less
More
- Posts: 508
- Thank you received: 11
17 years 11 months ago #2311
by malai
Replied by malai on topic To find a file in unix
tar
tar cvf - bnk.data | compress -> bnk.data.tar.Z
untar
zcat bnk.data.tar.Z | tar xvf -
_________________
M A L A I
tar cvf - bnk.data | compress -> bnk.data.tar.Z
untar
zcat bnk.data.tar.Z | tar xvf -
_________________
M A L A I
Please Log in or Create an account to join the conversation.
- malai
- Offline
- Platinum Member
Less
More
- Posts: 508
- Thank you received: 11
17 years 10 months ago #2312
by malai
Replied by malai on topic To find a file in unix
To extract a single file from a tar package
tar -xf tar.package.tar.Z /app/globus/bnk.run/TEST.BP/TEST.RTN
To compress a single fine into a tar package
zcat tar.package.tar.Z | tar xf - /app/globus/bnk.run/TEST.BP/TEST.RTN
_________________
M A L A I
tar -xf tar.package.tar.Z /app/globus/bnk.run/TEST.BP/TEST.RTN
To compress a single fine into a tar package
zcat tar.package.tar.Z | tar xf - /app/globus/bnk.run/TEST.BP/TEST.RTN
_________________
M A L A I
Please Log in or Create an account to join the conversation.
- Panos
- Offline
- Junior Member
Less
More
- Posts: 27
- Thank you received: 0
17 years 10 months ago #2313
by Panos
Replied by Panos on topic To find a file in unix
Supposing that there is a directory with 10 files. We go to that directory and type (exactly as below ? from ksh or bash) :
for file in `ls -1`;do sed -e 's/Panos/Emily/g' <$file >$file.x;mv $file.x $file;done
or :
sed -e 's/Panos/Emily/g' <input_file >temp_file
mv temp_file input_file
This will replace all occurrences of word Panos with the word Emily inside all files.
for file in `ls -1`;do sed -e 's/Panos/Emily/g' <$file >$file.x;mv $file.x $file;done
or :
sed -e 's/Panos/Emily/g' <input_file >temp_file
mv temp_file input_file
This will replace all occurrences of word Panos with the word Emily inside all files.
Please Log in or Create an account to join the conversation.
- malai
- Offline
- Platinum Member
Less
More
- Posts: 508
- Thank you received: 11
17 years 10 months ago #2314
by malai
Replied by malai on topic To find a file in unix
To execute OS related commands like
COPY
REMOVE
MOVE
.....
Use SYSTEM.CALL subroutine.
_________________
M A L A I
COPY
REMOVE
MOVE
.....
Use SYSTEM.CALL subroutine.
_________________
M A L A I
Please Log in or Create an account to join the conversation.
- ashok
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
17 years 5 months ago #2315
by ashok
Replied by ashok on topic Execute Unix Command inside Subroutine
Execute Unix Command inside Subroutine
Copy file Hold Control to local HDD
UNIX.CMD= 'sh - c 'cp ':FICHE.PATH:'/':HOLD.ID:' ':ANY.DIR:'/':NEW.REP.NAME:'''
EXECUTE UNIX.CMD
_________________
Ashok Pandey
Mayor Street
Dublin
Ireland
Copy file Hold Control to local HDD
UNIX.CMD= 'sh - c 'cp ':FICHE.PATH:'/':HOLD.ID:' ':ANY.DIR:'/':NEW.REP.NAME:'''
EXECUTE UNIX.CMD
_________________
Ashok Pandey
Mayor Street
Dublin
Ireland
Please Log in or Create an account to join the conversation.
- ironmaiden
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 83
- Thank you received: 0
17 years 4 months ago #2316
by ironmaiden
Replied by ironmaiden on topic To find a file in unix
If one wishes to copy the reports from HOLD.CONTROL to another unix folder when the user verifies the ENQUIRY.REPORT, they can set the PRINTER.ID and use it in DE.FORM.TYPE, The Id of the DE.FORM.TYPE can be used in REPORT.CONTROL, which inturn is attached to ENQUIRY.REPORT, A sample record of PRINTER.ID is shown below:
PRINTER.NAME...... ACSTMT
1 PRIME.PRINTER.ID.. HOLD
4. 1. 1 COMMAND..... SH -c 'cp ../bnk.data/eb/'&HOLD&'/&HOLD.CONTROL>@I
4. 1. 2 COMMAND..... D& STMT.BP/&HOLD.CONTROL>REPORT.NAME&.ID&
12 CURR.NO........... 4
13. 1 INPUTTER....... 1_ID.KARTHIK1
_________________
NJOY LIFE TO THE FULLEST
PRINTER.NAME...... ACSTMT
1 PRIME.PRINTER.ID.. HOLD
4. 1. 1 COMMAND..... SH -c 'cp ../bnk.data/eb/'&HOLD&'/&HOLD.CONTROL>@I
4. 1. 2 COMMAND..... D& STMT.BP/&HOLD.CONTROL>REPORT.NAME&.ID&
12 CURR.NO........... 4
13. 1 INPUTTER....... 1_ID.KARTHIK1
_________________
NJOY LIFE TO THE FULLEST
Please Log in or Create an account to join the conversation.
- malai
- Offline
- Platinum Member
Less
More
- Posts: 508
- Thank you received: 11
17 years 4 months ago #2317
by malai
Replied by malai on topic To find a file in unix
To find the port number from PID.
To get PID for the tSA's
SH -c 'ps -ef | grep tSA'
To get PORT no from the PID
SH -c 'WHERE (V | grep pid'
Execute these commands in jBASE prompt itself.
_________________
M A L A I
To get PID for the tSA's
SH -c 'ps -ef | grep tSA'
To get PORT no from the PID
SH -c 'WHERE (V | grep pid'
Execute these commands in jBASE prompt itself.
_________________
M A L A I
Please Log in or Create an account to join the conversation.
- KingArthur
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 1
16 years 11 months ago #2318
by KingArthur
Replied by KingArthur on topic To clear
To clear the files in all the directories without deleting the directories.
find -type f -mtime +1 -print -exec rm -f {} ;
where +1 will delete all the files that are not accesed 1 day before.
King Arthur
find -type f -mtime +1 -print -exec rm -f {} ;
where +1 will delete all the files that are not accesed 1 day before.
King Arthur
Please Log in or Create an account to join the conversation.
- malai
- Offline
- Platinum Member
Less
More
- Posts: 508
- Thank you received: 11
16 years 9 months ago #2319
by malai
Replied by malai on topic Listing Big files in a directory
Its a UNIX command.
ls -l | awk '{print $5,$9}' | sort -n
ls -l | awk '{print $5,$9}' | sort -n
Please Log in or Create an account to join the conversation.
- KingArthur
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 1
16 years 9 months ago #2320
by KingArthur
Replied by KingArthur on topic Searching
To search a particular text in a file use
grep -i -n 'your text'
To find the no of occurances
grep -i -n 'your text' | wc -l
King Arthur
grep -i -n 'your text'
To find the no of occurances
grep -i -n 'your text' | wc -l
King Arthur
Please Log in or Create an account to join the conversation.
- KingArthur
- Offline
- Senior Member
Less
More
- Posts: 75
- Thank you received: 1
16 years 8 months ago #2309
by KingArthur
Replied by KingArthur on topic To find a file in unix
To find temp files from the current path
find . -name *tmp* -print
King Arthur
find . -name *tmp* -print
King Arthur
Please Log in or Create an account to join the conversation.
Time to create page: 0.140 seconds