LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-04-2014, 01:50 AM   #1
malayo
Member
 
Registered: Dec 2010
Posts: 130

Rep: Reputation: 1
cutting path of text files path


6th depth changes (output of "find /mnt/zarchive/hsm/0/ -name *.msg > /mnt/zarchive/listMsgHsm.txt") from a zimbra HSM folder

when I tried running on a path e.g.: cut -d "/" -f 5 /mnt/zarchive/hsm/0/10/msg/0/269-322.msg

It outputs whole text in 269-322.msg

how do I to only get "10" (mailbox ID), 5th if using "/" as delimeter for cut?
 
Old 05-04-2014, 04:58 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The reason is 'cut' works on an input stream or file:
Code:
 ~]$ echo '/mnt/zarchive/hsm/0/10/msg/0/269-322.msg' | cut -d "/" -f 6
10

~]$ grep "/mnt/zarchive/hsm/0/10/msg/0/269-322.msg" /mnt/zarchive/listMsgHsm.txt | cut -d "/" -f 6
10
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
eval $PATH produces a path list followed by No such file or directory warning Alpha90 Linux - Newbie 10 11-04-2012 10:16 AM
[SOLVED] Perforce edits my files when I give a depot path but not if I specify the local path gregorian Linux - Software 1 10-21-2011 11:57 AM
Perforce edits my files when I give a depot path but not if I specify the local path gregorian Linux - Software 1 10-07-2011 05:03 PM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
script to change unix path to windows path in all files csross Programming 8 04-29-2006 01:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration