- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How do I seperate last 12 charcters in the a outpu...
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
Discussions
Discussions
Forums
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
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
тАО03-10-2005 07:25 AM
тАО03-10-2005 07:25 AM
How do I seperate last 12 charcters in the a output file.
1st whatever number charcters and
just last 12 charcters.
I have a file created by fconfig of EMC, which gives LUN Path followed by frame ID,
I want to seperate the two, they are displayed in joint for right now..
Pls assist
Thx
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2005 07:51 AM
тАО03-10-2005 07:51 AM
Re: How do I seperate last 12 charcters in the a output file.
INFILE=myfile
typeset -i LEN=$(ls -l ${INFILE} | awk '{print $5}')
typeset -i LEN1=$(( ${LEN} - 12 ))
PART1=$(head -c -n ${LEN1} ${INFILE})
PART2=$(tail -c -12 ${INFILE})
echo "Part1 = ${PART1}"
echo "Part2 = ${PART2}"
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2005 07:55 AM
тАО03-10-2005 07:55 AM
Re: How do I seperate last 12 charcters in the a output file.
cat yourfile | tail -1 |
while read line
do
first=${line%????????????} #12 ?'s
print $first
last12=${line#$first}
print $last12
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2005 08:00 AM
тАО03-10-2005 08:00 AM
Re: How do I seperate last 12 charcters in the a output file.
Thx
Prash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2005 08:02 AM
тАО03-10-2005 08:02 AM
Re: How do I seperate last 12 charcters in the a output file.
cat yourfile |
while read line
do
first=${line%????????????} #12 ?'s
last12=${line#$first}
print $last12
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2005 03:18 PM
тАО03-10-2005 03:18 PM
Re: How do I seperate last 12 charcters in the a output file.
for example
C:\temp>type x.txt
aap noot mies123456789012
teun0123456789xx
vuur roosyy1234567890
could solve with awk as:
C:\temp>awk "{l=length($0); print substr($0,1,l-12), substr($0,l-11,12)}" x.txt
aap noot mies 123456789012
teun 0123456789xx
vuur roos yy1234567890
or with sed or perl....
C:\temp>perl -pe "s/(.{12})$/ \1/" x.txt
aap noot mies 123456789012
teun 0123456789xx
vuur roos yy1234567890
is that what you need?
Hein
- Tags:
- Perl