nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

need help in getting a part from a file.

This is a discussion on need help in getting a part from a file. within the Shell scripting forums, part of the Development/Scripting category; My files name is Prices it contains: Products:Company1:Company2:Company3 Monitor:23:34:45 Keyboard:34:45:56 Printer:...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-05-2008, 04:44 PM
Junior Member
User
 
Join Date: May 2008
My distro: Suse
Posts: 1
topdog is on a distinguished road
Talking need help in getting a part from a file.

My files name is Prices
it contains:
Products:Company1:Company2:Company3
Monitor:23:34:45
Keyboard:34:45:56
Printer:21:40:22
Scanner:32:66:45


How can i get the number 66 form the line "Scanner:32:66:45".
Thanks very much!
Reply With Quote
  #2 (permalink)  
Old 05-05-2008, 08:27 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 545
rockdalinux is on a distinguished road
Default

Try cut command to print 3rd field using : as a delimiter

Code:
echo 'Scanner:32:66:45' | cut -d: -f3
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
Reply

Bookmarks

Tags
cut , shell script

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Sun Certified System Administrator for the Solaris 10 OS, Part I (CX-310-200) nkechifesie Solaris/OpenSolaris 8 02-18-2008 01:44 PM
Read arguments from a file and pass them to binary file AHJ Shell scripting 1 10-31-2007 06:04 PM
Script to extract some part of files: satish1482 Shell scripting 0 03-13-2007 05:30 PM
FreeBSD setup ACL or Access control list tutorial part # 1 nixcraft Getting started tutorials 2 12-20-2006 01:55 AM
convert pdf (ppt file) into wordppt file sureshbup Linux software 1 12-07-2006 03:51 PM


All times are GMT +5.5. The time now is 04:07 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35