This is a simplified minimal conky configuration file used to show the same problem:
Code: Select allalignment bottom_middle
background no
border_width 1
default_color white
default_outline_color white
default_shade_color white
double_buffer yes
[Code] ....
Here is the output I'm getting:
Code: Select all ABC /*doesn't scroll, UNEXPECTED, shows 10 spaces before ABC*/
ABC --||--
abcdefghijklmnopABC /*doesn't scroll, WORKS AS EXPECTED as scroll length is 25 which is longer than text "abcdefghijklmnop" */
abcdefghijklmnopABC --||--
abcdefghijklmnopABC /*WORKS, everything before ABC scrolls 5 characters at a time*/
I'm trying to define a variable, CHAN, by dividing another variable, FREQ, by a number. FREQ is a value from a file (called header.txt). What I think I'm doing with this bit of code is reading a number from header.txt whose location is specified by the head and tails, assigning it to FREQ and then defining CHAN with bc.
I would like to extract Room number, Lastname,Firstname,invoice (205880080),arrival date, departure date, and total(229.46). Can you at least give me a hint on how to proceed? I have tried a lot but I am stumped from the beginning.
***History*** Room: 124 B Payment: Bell/TRAVELSCAPE.COM Lastname*FIT*,Firstname 4A, 0K, 0B Guest Bell *205880080 FT Bell *205880080 July 31, 2010
I am trying to think of a logic where my file contains some data I had to read and do some processing. Issue is that file contains data multiple times. For example:
::::::::::: var1=value1 var2=value2
[code].....
I have to read first paragraph of variables and do some processing and then move on until the end of file. Variable names are same in whole file but for each paragraph the value is different. I can't think of a logic to attain this task. How can I do it? It should be a simple bash script, but I am not able to work out.
Code: #include <stdio.h> struct test { int i; int j;
[Code]....
why i am getting this error. I know the error is occuring because i have assigned values to obj.i and obj.j outside main(). But i want to know why do that result in an error. From my part i have created an object 'obj' of stucture 'test' and assigned values to its variables.
trying to create something that will periodically send messages to a serial device using socat, take the response from the device and format it, then take the formated data and send it out UDP to a specific IP/Port.I tried to do something along the lines ofsocat <readline> <serial device> | parse script/program | socat -u <readline> <UDP:IP:Port> but didn't have any success.socat READLINE,history=$HOME/.cmd_history /dev/ttyS1,raw,echo=0,crnl | format.sh | socat -u READLINE,history=$HOME/.cmd_history UDP:IP:Port
There is a file with that format of each models' information.I don't think that's good format, but I cannot change that format. I needed to modify the model name, 'model = xxx' as 'model = abc'.And I don't know how to parse and modify 'model = iii' and 'model = ddd'.The only clue to parse 'model = ddd' is the second 'model = ' after the second 'system information'. But how to parse the second keyword?Is it possible with 'sed'?I sometimes have to modify the information of the file.using shell script if possible.Python is ok. (Shell script is better for me.)
Said that all the config i find put all the info in one place of the screen, in this example on the right side:
url
or like conky colors where you can put in either side, or other complex examples that use folders with images..that at least i need one day to study all the variables it has...
What i want is something simple, in my black background i dont want images and effects, only white simple text.
My problem is: i want for instance my specs above, my log info in the middle, my music info bellow (above my clock) and in conky config i'm hitting my head in the wall....
For instance if i use my facebook script to appear in the midle how the hell can i put my music info bellow without ruined the facebook in the midle...do i need 2 conky configs?
I have the following code: Code: #include <stdio.h> #include <stdlib.h> int main() { system("ps -ef | grep myprocessname"); return 0; }
When I run this program it outputs the following list of running processes: Code: root 10279 10275 0 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2 root 10341 10337 1 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2
What I want to really do is instead of writing the output to screen I want to read the output and parse the various values value1, value2 etc. What is the best way to do this?
Given that I want my shell script be invoked at the command line using the above parameters - where [these brackets] denote that they are optional - what is the best method to parse them?
I recently installed Firefox 3.6 on Debian Squeeze. Everything went smoothly, but Firefox looks weird. The interface reminds me of Windows 98 and anytime I scroll through the menus the highlighter is grey and it makes things awfully hard to read. I'm not sure what could be wrong but I'm hoping someone here I'm not sure how to insert small images as url links so I'll just post links to screenshots I took for reference.[URL]Oh, and one other problem I recently discovered, flash doesn't seem to work. It works just fine in Iceweasel but I am told I have to install it in Firefox. I installed libflashplayer.so in /usr/lib/firefox/plugins but that doesn't seem to have helped. Come to think of it, it probably wouldn't since it's probably the 32-bit version I got from their site, I run on 64 bit.
I have some problem with dzen2 & conky to show icons and/or colors.In my i3-wm config file i have:exec conky -b -c ~/.conkyrc | i3-wsbar --command "dzen2 -dock -x %x -l"and my conky is correctly displayed on i3-wsbar.But if in my conky I put something like:
^fg(#B64403) mem: $memperc% or ^fg(red) mem: $memperc%
With my .conkyrc. Whenever I output the values of any of the mixer variables, eg. mixer, mixerbar, mixerl, mixerlbar, mixerr, mixerrbar - the correct value is initially displayed but it only persists for one iteration of conky. As soon as conky refreshes (2 secs. in my case), the value goes to zero (0). I'd have to restart conky in order to get another reading until conky loops/refreshes again.
I'm sure that it's not normal behavior because nothing else in conky seems to work this way. Has anyone come across this? I couldn't find a mention of it anywhere.
New to ubuntu and shell scripting in general... currently I stored some data into a text file. Right now, I would like to output the data from the text file and store it into a variable. Here's what I have so far:
READ_FILE=$(cat $FILE_NAME)
This definitely works and READ_FILE has the necessary data. However, this command will trigger an output to std output and I will see data on the screen, which is not what I want. I tried:
cat $FILE_NAME | $READ_FILE
and various other variants of this. It does not output to std output but neither does anything gets stored into $READ_FILE. I tried:
cat $FILE_NAME >> $READ_FILE
and it arrived at an error of "ambiguous redirect".
I tried using the tail command in my shell script and storing that value in a variable a but an error keeps coming. Is there any other way to store the output of a command into a variable. Cannot Read text from text file and store it in a variable using shell script. The thing is I need a number from the file new.txt and use that number in my script
#!/bin/bash a = `tail -1 new.txt|head -n 1` echo $a
So that when I grep on the local file again later, it can be printed out with original log lines. Otherwise, the log lines will be dropped and lines becomes concatenated into a single line, e.g., if I rewrite the script in this way, echoing the $result is not a good idea..
is there some workaround that I can save it to a variable rather than file but still keep the eol? That will simplify my script and don't need to do all those I/Os!
I have a bash script that calls a java class method. The method returns a string to the linux console when run independently. how can I assign the value from the java method to a variable in a bash script?running the script: java -cp /opt/my_dir/class.method [parameter]
I would like to grep two numbers out of a text file, and divide them.
Here is the script code...
It feels like grep saves a new line too? or what is happening? i simply can't divide them, as it handles the variables as they are empty (and prints the two numbers although they were not printed
!<number> to execute the Nth command(use history to see the list). Or you can use
Code:
cd !-2:1
to cd into the value in the first field that was executed 2 commands ago Anyhow, say I run a command and the output is a path. Any way to cd and then some variable where OUTPUT of the previous command was stored? A variable that always stores the OUTPUT of the last command.
Suppose I want to account number of files beginning with abc , I can use "ls 'abc* | grep abc | wc -l", this will return me a number. I want to store this number in a variable, say var1, so I tried 1. "ls 'abc* | grep abc | wc -l |read var1", but this didn't work as var1 has no value somehow. 2. var1='ls 'abc* | grep abc | wc -l', this just assign the entire string "ls 'abc* | grep abc | wc -l" to var1, which is not I wanted.
I don't want to store the value to a temporary file and then read the value from that file. I think there should be a direct way to get the value, but don't know how. I know in tcsh, one can just use set var1='ls 'abc* | grep abc | wc -l', but it also doesn't work in bash. Can anyone give any clue about this?