- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script help
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
10-06-2003 02:20 PM
10-06-2003 02:20 PM
script help
I've been getting good tips from you
thank you
so I post a message..like script problem
gaul IN A 211.230.50.34
buksan IN A 211.230.50.34
sangwhang IN A 211.230.50.34
younhz IN A 211.230.50.34
kixx IN A 211.230.50.34
pooh4001 IN A 211.230.50.34
pdy1260 IN A 211.230.50.34
edonlee IN A 211.230.50.34
pun255840 IN A 211.230.50.34
buwon2702 IN A 211.230.50.34
leeys56 IN A 211.230.50.34
hyi2900 IN A 211.230.50.34
gemhee IN A 211.230.50.34
jso9782 IN A 211.230.50.34
arc1370 IN A 211.230.50.34
dong1637 IN A 211.230.50.34
eelchoi IN A 211.230.50.34
junlee IN A 211.230.50.34
jdoryong IN A 211.230.50.34
cjfgh61 IN A 211.230.50.34
sansarang IN A 211.230.50.34
hoamshin IN A 211.230.50.34
kcmkjk IN A 211.230.50.34
bhsong52 IN A 211.230.50.34
bamgol IN A 211.230.50.34
lsk2104 IN A 211.230.50.34
sasum4388 IN A 211.230.50.34
kjs3896 IN A 211.230.50.34
hannul IN A 211.230.50.34
rnwhdah70 IN A 211.230.50.34
....
omitted..
As you see lines 'IN A 211.230.50.34' is
not aligned
so I have been editting it by vi and up and
down keyboard, press tabs or space keys to make them align
it is boring and waste too much time.
totals are over 200 lines.
How can I use script to reduce time like doing
jobs.
Any tips will be helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2003 02:34 PM
10-06-2003 02:34 PM
Re: script help
#!/usr/bin/sh
PATH=/usr/bin
set -u
typeset -L10 MYNAME
typeset -L2 IN
typeset -L1 A
typeset -L15 IPADDR
cat | while read MYNAME IN A IPADDR
do
print "$MYNAME $IN $A $IPADDR"
done
To use the script:
cat unformatted_file | this_script
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2003 03:28 PM
10-06-2003 03:28 PM
Re: script help
Off my head, here's a not-so-clean approach:
# cat $file | awk '{print $1"\t"$2"\t"$3"\t"$4}'
However, you need to set your tab size to a size that exceeds the length of your first name field so that all tabs get aligned.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2003 05:51 PM
10-06-2003 05:51 PM
Re: script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2003 05:57 PM
10-06-2003 05:57 PM
Re: script help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2003 06:21 PM
10-06-2003 06:21 PM
Re: script help
tag will play havoc with the formatting!
You need to pipe your data into this script.
#!/usr/bin/perl
format =
@<<<<<<<<<<<<<<<<<<< @<< @< @<<<<<<<<<<<<<<<
$text, $ch, $letter, $IP
.
while(<>){
($text,$ch,$letter,$IP)=split " ",$_;
write;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2003 12:24 AM
10-07-2003 12:24 AM
Re: script help
print "$MYNAME___$IN___$A________$IPADDR"
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2003 12:40 AM
10-07-2003 12:40 AM
Re: script help
An alternative to typeset is to use printf
while read a b c d
do
printf "%10s, %2s, %1s, %15s\n" $a $b $c $d
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2003 03:28 AM
10-07-2003 03:28 AM
Re: script help
perl -pi -e 's/(\w{8,})\s(IN)\s(A)\s(.*)/$1\t$2\t$3\t$4/;s/(\w*(?!\t))\s(IN)\s(A)\s(.*)/$1\t\t$2\t$3\t$4/' file
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2003 03:55 AM
10-07-2003 03:55 AM
Re: script help
awk '{printf("%s %2s %1s %15s\n",substr($1" ",1,10),$2,$3,$4);}'
Rgds,
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2003 03:56 AM
10-07-2003 03:56 AM
Re: script help
in substr($1" " ... 9 spaces.
Another strange behaviour here !
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2003 04:21 AM
12-19-2003 04:21 AM
Re: script help
cat dnsfile | awk '{print $1,"/t",$2,"/t",$3,"/t",$4}' >newdnsfile
Michael
king of the one liners...