Shell scripting- cut the location of the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell scripting- cut the location of the file
# 1  
Old 03-18-2013
Blade Shell scripting- cut the location of the file

Hi,

I need to just cut the location of file and give it as input to the other command. For example:
Code:
ct lsview | grep kavya-
* kavya-telecom-view   /first/nso01/disk2/views/kavya-telecom-view.vws

I need only the location like /first/nso01/disk2/views/kavya-telecom-view.vws.How to cut that part.

Thanks to help.

Last edited by Franklin52; 03-18-2013 at 07:57 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 03-18-2013
Pls use code tags as required by forum rules!

Code:
$ ct lsview | awk '/kavya-/ {print $3}'
/first/nso01/disk2/views/kavya-telecom-view.vws

or
Code:
$ ct lsview | grep kavya- | cut -d" " -f3

Reading man pages or searching these fora sometimes really helps!
# 3  
Old 03-18-2013
Hi thanks for the reply.

But 2nd one it is shoeing invaild delimiter. And if possible can you explain the 1st one???
# 4  
Old 03-18-2013
awk '/kavya-/ -- > If your input line contains "Kavya-" in it , {print $3}' ---> print the third field ..Default delimiter is space here.
# 5  
Old 03-18-2013
"Invalid delimiter" would be very surprising unless you have a typo when copying the command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File transfer from UNIX to shared location using shell script

Is there any possible way transfering the file from unix to shared location using shell script. i had created the batch script to fetch the files from unix to shared location and it works fine. Due to some problem in windows unable to transfer the file to shared location automatically. can anyone... (2 Replies)
Discussion started by: venkat918
2 Replies

2. Shell Programming and Scripting

Shell script to read specified value from file and echo to the same location to other file.

Hello. I want to to backup some "default:" values from a file do some other job and after restore that "default:" values back. The problem is that the source and destination file has a lot of default: strings in it but with different values... So.. Here is an example: A part of my source... (6 Replies)
Discussion started by: ausdim
6 Replies

3. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

4. Shell Programming and Scripting

How to find a existing file location and directory location in Solaris box?

Hi This is my third past and very impressed with previous post replies Hoping the same for below query How to find a existing file location and directory location in solaris box (1 Reply)
Discussion started by: buzzme
1 Replies

5. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

6. Shell Programming and Scripting

File created in a different location instead of desired location on using crontab

Hi, I am logging to a linux server through a user "user1" in /home directory. There is a script in a directory in 'root' for which all permissions are available including the directory. This script when executed creates a file in the directory. When the script is added to crontab, on... (1 Reply)
Discussion started by: archana.n
1 Replies

7. Shell Programming and Scripting

shell script to add input at certain location into a file

Hi, I am using Solaris 10 OS and trying to create shell script that can add input at certain location into a file. The input that I am trying to put is new domain name e.g @newdomain.com the file contains, more test01.out user/zzzz786@st.com/INBOX user/zzzz@po.com/INBOX... (8 Replies)
Discussion started by: Mr_47
8 Replies

8. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

9. Shell Programming and Scripting

Put one string from one location to another location in a file

Hi Everyone, I have 1.txt here a b c' funny"yes"; d e The finally output is: here a b c d e' funny"yes"; (1 Reply)
Discussion started by: jimmy_y
1 Replies

10. UNIX for Dummies Questions & Answers

How to cut data block from .txt file in shell scripting

Hi All, Currently i have to write a script. For which i need to cut a block from .txt file. I know the specific word that starts the block and ends the block. Can we do it in shell scripting..? Please suggest.... (6 Replies)
Discussion started by: pank29
6 Replies
Login or Register to Ask a Question