Sponsored Content
Top Forums Shell Programming and Scripting Updating value from new last line of tempfile Post 302945575 by sea on Sunday 31st of May 2015 06:57:11 PM
Old 05-31-2015
@ The tab chars are in my code, copy paste preserves them usualy.

Thanks for your feedback, sadly i seem to apply this somehow wrong...

Function:
Code:
	PlayStatus() { # FILE
	# Prints the extra status play bar
	# Time as Progress, yay 
		# Vars
		PT=$(PlayTime)		# Get nice displayed playtime
		PTS=$(PlayTimeSecs)	# Get playtime as seconds
		[ "00" = "${PT:0:2}" ] && \
			PT="${PT/00:}"	# Cut off 'empty' leading hours
		PT="${PT/.*}"		# Cut off miliseconds
		STATUS="$TMP.playstatus"
		
		# Make required changes at the command file
		$SED s,'v quiet','hide_banner',g -i "$TMP"
		#$SED s,"||","1\>$STATUS 2\>$STATUS ||",g -i "$TMP"
		$SED s,"||"," 2\>$STATUS ||",g -i "$TMP"
		
		# Start job
		$SHELL "$TMP" &
		PID=$!
		sleep 0.7
		
		# TMP command
		tui-title "DIV"
		tui-cat $TMP
		tui-title "DIV"
		
		# Print information line
		while ps $PID > /dev/null
		do	CUR=$(tail -n1 "$STATUS"|awk '{print $1}')
			echo tui-progress -bm "$PTS" -c "$CUR" "$CUR/$PT"
			sleep 0.7
		done
		return
}

sh -x : output, still doesnt update the $CUR variable Smilie
Code:
+++ echo 00:58:46.03
++ str_work=00:58:46.03
++ base=46.03
++ mins=00:58
++ hours=00
++ H=0
++ M=3480
++ echo 46.03 3480 0
++ awk '{print int ($1 + $2 + $3)}'
+ PTS=3526
+ '[' 00 = 00 ']'
+ PT=58:46.03
+ PT=58:46
+ STATUS=/home/sea/.cache//vhs.tmp.playstatus
+ sed 's,v quiet,hide_banner,g' -i /home/sea/.cache//vhs.tmp
+ sed 's,||, 2\>/home/sea/.cache//vhs.tmp.playstatus ||,g' -i /home/sea/.cache//vhs.tmp
+ PID=6890
+ sleep 0.7
+ /bin/bash /home/sea/.cache//vhs.tmp
+ tui-title DIV
# |                                                      DIV                                                       | #
+ tui-cat /home/sea/.cache//vhs.tmp
# | ffplay -hide_banner -window_title "VHS (2.1.6) : Play audio File : joined_files.mp                             | #
# |                             3" -i "joined_files.mp3" -nodisp  2>/home/sea/.cache//vhs.tmp.playstatus || exit 1 | #
+ tui-title DIV
# |                                                      DIV                                                       | #
+ ps 6890
++ tail -n1 /home/sea/.cache//vhs.tmp.playstatus
++ awk '{print $1}'
+ CUR=0.01
+ echo tui-progress -bm 3526 -c 0.01 0.01/58:46
tui-progress -bm 3526 -c 0.01 0.01/58:46
+ sleep 0.7
+ ps 6890
++ tail -n1 /home/sea/.cache//vhs.tmp.playstatus
++ awk '{print $1}'
+ CUR=0.01
+ echo tui-progress -bm 3526 -c 0.01 0.01/58:46
tui-progress -bm 3526 -c 0.01 0.01/58:46
+ sleep 0.7
+ ps 6890
++ tail -n1 /home/sea/.cache//vhs.tmp.playstatus
++ awk '{print $1}'
+ CUR=0.01
+ echo tui-progress -bm 3526 -c 0.01 0.01/58:46
tui-progress -bm 3526 -c 0.01 0.01/58:46
+ sleep 0.7
^C

What am i doing wrong?
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

2. Shell Programming and Scripting

Updating a line in a large csv file, with sed/awk?

I have an extremely large csv file that I need to search the second field, and upon matches update the last field... I can pull the line with awk.. but apparently you cant use awk to directly update the file? So im curious if I can use sed to do this... The good news is the field I want to... (5 Replies)
Discussion started by: trey85stang
5 Replies

3. Shell Programming and Scripting

updating a single line by script

hi, I'm trying to add a # to the beginning of the line where the a word is included. and the i want to run the whole original script. and if possible I would prefer that line would stay in the same order in the text file, the line which includes the word. Thanks, (10 Replies)
Discussion started by: ozum
10 Replies

4. AIX

Updating AIX OS

Hello I have a server whose os level reads 5300-01-00-0000. It has to be upgraded to the latest level which is 5300-12-04-1119. What would I need to do go get the server to this point? Would I need to go through each patch level until I get it to current? If so, would anyone happen to know... (1 Reply)
Discussion started by: stayfuzzy
1 Replies

5. Shell Programming and Scripting

Need help for updating the folder

Hello Expert, is there any command through which i can update/replace the folder after every two months. lets say i have folder /usr/local/x_folder created on 01/01/2011 I need to update it on 31/03/2011 Please help me to get the logic :confused: Thanks (3 Replies)
Discussion started by: aks_1902
3 Replies

6. SCO

FoxPro 2.6 and updating UW

I have an app in FP26 with 400 prgs currently en UW7.1.1 thats work perfectly. I have a new server and install UW7.1.4 and FP26. Then I had copy my App to new server. But the next command doesn't work: use database @10,10 get name read I can't write in the get. ... (5 Replies)
Discussion started by: AralVorkosigan
5 Replies

7. Ubuntu

16.04 not updating

Just installed the latest version on my hp stream, was tired of windows. Of the few times I've used Linux, this is the first time it won't update. Im connected to the net the updater recognizes that the OS needs 21 updates. But it won't download/install the updates. It also won't load the... (1 Reply)
Discussion started by: DabblingMadman
1 Replies

8. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
copymsg(9F)						   Kernel Functions for Drivers 					       copymsg(9F)

NAME
copymsg - copy a message SYNOPSIS
#include <sys/stream.h> mblk_t *copymsg(mblk_t *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mp Pointer to the message to be copied. DESCRIPTION
copymsg() forms a new message by allocating new message blocks, and copying the contents of the message referred to by mp (using the copyb(9F) function). It returns a pointer to the new message. RETURN VALUES
If the copy is successful, copymsg() returns a pointer to the new message. Otherwise, it returns a NULL pointer. CONTEXT
copymsg() can be called from user or interrupt context. EXAMPLES
Example 1: : Using copymsg The routine lctouc() converts all the lowercase ASCII characters in the message to uppercase. If the reference count is greater than one (line 8), then the message is shared, and must be copied before changing the contents of the data buffer. If the call to the copymsg() function fails (line 9), return NULL (line 10), otherwise, free the original message (line 11). If the reference count was equal to 1, the message can be modified. For each character (line 16) in each message block (line 15), if it is a lowercase letter, convert it to an upper- case letter (line 18). A pointer to the converted message is returned (line 21). 1 mblk_t *lctouc(mp) 2 mblk_t *mp; 3 { 4 mblk_t *cmp; 5 mblk_t *tmp; 6 unsigned char *cp; 7 8 if (mp->b_datap->db_ref > 1) { 9 if ((cmp = copymsg(mp)) == NULL) 10 return (NULL); 11 freemsg(mp); 12 } else { 13 cmp = mp; 14 } 15 for (tmp = cmp; tmp; tmp = tmp->b_cont) { 16 for (cp = tmp->b_rptr; cp < tmp->b_wptr; cp++) { 17 if ((*cp <= 'z') && (*cp >= 'a')) 18 *cp -= 0x20; 19 } 20 } 21 return(cmp); 22 } SEE ALSO
allocb(9F), copyb(9F), msgb(9S) Writing Device Drivers STREAMS Programming Guide SunOS 5.10 27 Jun 1995 copymsg(9F)
All times are GMT -4. The time now is 11:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy