- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- About the script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2003 03:17 AM
05-05-2003 03:17 AM
my question is how to use "cut" to cut the result .
# cat abc.txt
# abcdefghij
I would like to write a script to cut the result as "abcghi" ? thx.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2003 03:20 AM
05-05-2003 03:20 AM
Re: About the script
cat abc.txt | cut -c1-3,7-9
Have a look at the man pages for cut.It will give you examples at the end
HTH
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2003 03:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2003 03:35 AM
05-05-2003 03:35 AM
Re: About the script
# cut -c1-3,7-9 abc.txt
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2003 03:39 AM
05-05-2003 03:39 AM
Re: About the script
u have got the answers already. may i request you to spend some time reading a book on shell programming.
and, next time before you post a question, have a look at this.
http://www.catb.org/~esr/faqs/smart-questions.html
sorry, i dont mean to offend.
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 02:51 AM
05-06-2003 02:51 AM
Re: About the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 02:54 AM
05-06-2003 02:54 AM
Re: About the script
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 08:15 PM
05-06-2003 08:15 PM
Re: About the script
i have find out some process id and save it to a file - "/tmp/dead_pid" as below,
# more /tmp/dead_pid
4584
2548
5844
"
"
except
#kill 4584
#kill 2548
#kill 5844
How can I set a script to kill these process for one time? thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 08:22 PM
05-06-2003 08:22 PM
Re: About the script
cat /filename | xargs -l kill -TERM
-balaji
ps: how abt assigning points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 08:30 PM
05-06-2003 08:30 PM
Re: About the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 09:08 PM
05-06-2003 09:08 PM
Re: About the script
eg.
if i have a file "/tmp/file1"
# more /tmp/file1
pts/1
pts/2
pts/3
except use
# ps -ef |grep pts/1
# ps -ef |grep pts/2
# ps -ef |grep pts/3
how to find the result for one time ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 10:09 PM
05-06-2003 10:09 PM
Re: About the script
[balajin@redpenguin balajin]$ cat /tmp/file1
pts/1
pts/2
pts/3
[balajin@redpenguin balajin]$ grep -e "pts/1" -e "pts/2" -e "pts/3" /tmp/file1
pts/1
pts/2
pts/3
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 10:10 PM
05-06-2003 10:10 PM
Re: About the script
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 01:08 AM
05-07-2003 01:08 AM
Re: About the script
thx r reply , but my question is ,
# more /tmp/file1
pts/1
pts/2
pts/3
except use
# ps -ef |grep pts/1
# ps -ef |grep pts/2
# ps -ef |grep pts/3
how to find the result , I would like the result as :
acc_usr 14585 14584 0 14:34 pts/22 00:00:00 [_ll]
root 14928 30712 0 15:10 ? 00:00:00 in.telnetd: 168.162.0.1
root 14929 14928 0 15:10 ? 00:00:00 [login]
edp_usr 14930 14929 0 15:10 pts/24 00:00:00 -bash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 01:25 AM
05-07-2003 01:25 AM
Re: About the script
to kill the processes that u have /tmp/file1, u can do
# for i in `cat /tmp/file1`
> do
> kill -9 $i
>done
to grep process ids
# for i in `cat /tmp/file1`
> do
> ps -ef|grep $i >> /tmp/pids
>done
here file /tmp/pids contains the list of all processes which matches to those in the file /tmp/file1
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 01:28 AM
05-07-2003 01:28 AM
Re: About the script
i cant understand your question completely. no relation between what u show in the files and the output you want?
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 01:39 AM
05-07-2003 01:39 AM
Re: About the script
acc_usr 14585 14584 0 14:34 pts/22 00:00:00 [_ll]
root 14928 30712 0 15:10 ? 00:00:00 in.telnetd: 168.162.0.1
root 14929 14928 0 15:10 ? 00:00:00 [login]
edp_usr 14930 14929 0 15:10 pts/24 00:00:00 -bash
what can i do? thx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 02:22 AM
05-07-2003 02:22 AM
Re: About the script
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 02:24 AM
05-07-2003 02:24 AM
Re: About the script
Please note :-
This member has assigned points to 79 of 241 responses to his/her questions.
If these members have assisted you then please assign points.
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:20 AM
05-07-2003 03:20 AM
Re: About the script
I assume that you want to have displayed the processes associated with the terminals described in /tmp/file1. If this is correct, then try this simple script, show_procs.sh:
#!/usr/bin/sh
while read TERM
do
ps -ft$TERM| grep -v COMMAND
done <$1
And run it like this:
# show_procs.sh /tmp/file1
regards,
John K.