Sponsored Content
Top Forums Shell Programming and Scripting dirname, save cut portion to variable, clean up Post 302243918 by cfajohnson on Monday 6th of October 2008 08:23:44 PM
Old 10-06-2008

The shell has parameter expansion that can do what you want; there is no need for an external command:

Code:
path="/home/xbmc/sab_downloads/video/tv/grey's anatomy/season 3"
showseason=${path#/home/xbmc/sab_downloads/video/tv/}
show=${showseason%/*}

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Save contents of a Variable

I want to save the contents of a variable to a file. How can that be achieved? I have tried with: echo $varname > textfile.txt but for some reason it does not print anything. (1 Reply)
Discussion started by: carl_vieyra
1 Replies

2. Shell Programming and Scripting

Setting basename and dirname variable to simply script.

Hello all, Can somebody explain to me how set up a basename and dirname variable to simplify this script. I currently have a 'infile' with the contents of FTTPDataPVC_ & BaaisDSLFeed. I need to add a basename and or dirname variable so that any additions can be made through the infile and not... (1 Reply)
Discussion started by: liketheshell
1 Replies

3. Shell Programming and Scripting

Cut portion of a field in shell scripts

Hi, I am a file with the following layout. field1|field2|field3|field4|field5|field6|field7 field1|field2|field3|field4|field5|field6|field7 field1|field2|field3|field4|field5|field6|field7 I need to write a file with the below layout field1|field2|fieldx|field6 where fieldx =... (5 Replies)
Discussion started by: shivacbz
5 Replies

4. Shell Programming and Scripting

Save output in a variable

Hi, I have a 3rd party tool on Solaris 8. I am running it thorugh my script but I am not able to capture its output into a variable. Like, I tried, but did not work. output=`/usr/bin/myTool` echo $output Also, I tried saving in a file but when I run, output is always shown on the... (19 Replies)
Discussion started by: angshuman_ag
19 Replies

5. Shell Programming and Scripting

how to save an output of a command in a variable

Hi, in shell script, i have the command swstart -p which returns an output. i want to store the output of this command into a variable. how i can do that excerpt from the script #!/usr/bin/ksh # # # # Program: swstart -p # # Description: Starts the sentinels on Slave server ... (4 Replies)
Discussion started by: lookinginfo
4 Replies

6. UNIX for Dummies Questions & Answers

Solved: how to save an output to a variable

i want to save the output of /scripts/whoowns domain.com to a username like $user = /scripts/whoowns domain.com but I'm not sure how to do that This is inside a bash script how can I get the output of /scripts/whoowns then save that to a variable? thanks! ---------- Post updated at... (0 Replies)
Discussion started by: vanessafan99
0 Replies

7. Shell Programming and Scripting

cut delimiter and save

i have list of names in a text file and I wanted to delete the commas en every line. for example: inside the text is a list of names in it with commas after each line. I wanted to delete these commas. which command must I execute for this? unix, dale, shawn, aaron, (4 Replies)
Discussion started by: garfish
4 Replies

8. UNIX for Advanced & Expert Users

How to save a data of a file into a variable?

My requirement is to read a column data from a file & save it in a variable for each row & process it. I am using the below code- Leadlines="$TGTFILE/Error.txt">>$log_file while read line do id = ` echo $line | cut -d "," -f1 ` email = ` echo $line | cut -d "," -f2 ` ----------- done My... (2 Replies)
Discussion started by: saga20
2 Replies

9. UNIX for Dummies Questions & Answers

I save the result in a variable

I have friends that this command worked perfectly, but I would like to save the result in a variable, which I have not achieved var=prueba.txt echo $var | cut -d "." -f 1 prueba I need to do this but does not work me salida=echo $var | cut -d "." -f 1 echo "result:$salida" ... (8 Replies)
Discussion started by: tricampeon81
8 Replies
DTK_VIDEO_EXEC(3)						Draw Toolkit manual						 DTK_VIDEO_EXEC(3)

NAME
dtk_video_exec - Start/stop/pause a video texture SYNOPSIS
#include <dtk_video.h> int dtk_video_exec(dtk_htex vid, int command, const void* arg); DESCRIPTION
This function changes the state (or playing position) of a video texture referenced by vid according to the value of command: DTKV_CMD_PLAY: Set the video to play. arg is interpreted as a pointer to a variable of type int whose non zero value indicates that the state change is asynchronous and can be finished after the function returns. If arg is NULL, the change is performed synchronously. DTKV_CMD_PAUSE: Set the video to pause. arg is interpreted as a pointer to a variable of type int whose non zero value indicates that the state change is asynchronous and can be finished after the function returns. If arg is NULL, the change is performed synchronously. DTKV_CMD_SEEK: Seek the video to the position specified by arg which is then interpreted as a pointer to a variable of type long representing the position in milliseconds from the beginning of the video. arg is allowed to be NULL. In that case, the video will be positioned at its start. vid must be a dynamic texture created by one of the functions dtk_create_video_*(3). If the video was already in the requested state, the function will do nothing. If the video is created from the live source (webcam, network broadcast...), executing DTKV_CMD_SEEK will fail. RETURN VALUE
0 if the state has been changed or was already the one requested, -1 otherwise. SEE ALSO
dtk_load_video_file(3), dtk_load_video_gst(3), dtk_load_video_test(3), dtk_load_video_udp(3), dtk_load_video_tcp(3) EPFL
2011 DTK_VIDEO_EXEC(3)
All times are GMT -4. The time now is 11:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy