Programming :: Using Sed With Variable Created Using Xargs / Unterminated Error

Jan 12, 2009

I have an awk program that finds all files of a specific filename and deletes them from selected subdirectories. There is logic in the awk to avoid certain subdirectories, and this is initialized via a parameter in the beginning statement of the awk. The parameter should have all of the subdirectory names at the top level. This varies from time to time, so I cannot hard-code the value.I'm having a problem initializing the awk parameter using sed. I'm setting a variable (named subdir) using an "ls" command piped to "xargs". I'm then trying to substitute that value into the awk using the sed command.

View 3 Replies


ADVERTISEMENT

Ubuntu Installation :: Error Installing TCL In 10.10 / Unterminated Quoted String?

Sep 24, 2010

Iḿ trying to install TCL 8.0.5 onto my machine, if i type �wish it tells me there are already these programs:

Code:
The program 'wish' can be found in the following packages:
* tk
* tk8.4
* tk8.5
* tk8.3
Try: sudo apt-get install <selected package>
The error trace is here:

Code:
luke@luke-laptop:~/Downloads/tcl8.0.5/unix$ ./configure
loading cache ./config.cache
checking for ranlib... ranlib
checking whether cross-compiling... no
checking for getcwd... yes
checking for opendir... yes
code....

checking system version (for dynamic loading)... ./configure: 1: Syntax error: Unterminated quoted string
Really not sure whats wrong, I�m horrible with linux if I�m honest, tried a couple of google searches but didn�t make very much progress.

View 2 Replies View Related

Programming :: Using AWK Within Bash Command Via Xargs

Mar 24, 2011

I often want to extract some info using awk from a variable/filename while running other things using xargs and sh. Below is an example:
Code: ls -1 *.txt | xargs -i sh -c 'NEW=`echo $0 | awk -F'_' '{print $1}'`; echo $NEW' {}

In the above case I would like to grab just the first field from a filename (delimited by '_') from within an sh command. This is a simplified example, where normally I would be doing some further data processing with the sh command(s).

The error message that I get is:
Code: }`; echo $NEW: -c: line 0: unexpected EOF while looking for matching ``'
}`; echo $NEW: -c: line 1: syntax error: unexpected end of file.
I haven't been able to figure out how to escape the awk command properly.

View 1 Replies View Related

Programming :: Xargs With Output Of Find

Jul 15, 2011

I'm testing some multi-plat java code and I'm getting a bit frustrated with the Linux tests. I need to run the command:
Code:
$ java -jar /home/developer/TCO/TabletComicOptimizer.jar <file> <args[]>
against all the files that match a specific criteria. I've tried various find syntax and I can't seem to get it right.

Normally I would just create a bash script and populate the results of find into an array and then just enumerate the collection but in this specific case I want to demonstrate this operation at the bash terminal.

I've tried things like:
Code:
~/TCO $ find . -type f -iname "*.cb[rz]" | xargs java -jar TabletComicOptimizer.jar {} 1200x1800 ;
Thinking that the {} is the substitution for each file returned by find but it's not working. How do I execute my java program against each result in the find operation?

View 6 Replies View Related

Programming :: Basename With Command Substitutions And Xargs

Jun 17, 2011

I get this behavior on Slackware 13.37, which includes BASH 4.1.010. Yes, BASH is my shell. I have a file called a.flac and I'm in the directory that contains it.

The output of the ls command is expected:
Code:
ls *.flac
gives:
Code:
a.flac

Removing the extension with basename works as expected:
Code:
basename a.flac .flac
gives:
Code:
a

Putting the above command in a variable substitution works as expected:
Code:
echo `basename a.flac .flac`
gives:
Code:
a

Using xargs with ls and a variable substitution works as expected:
Code:
ls *.flac | xargs -i echo `echo {}`
gives:
Code:
a.flac

However, when I try to add the basename command to the above command, it stops working.
Code:
ls *.flac | xargs -i echo `basename {} .flac`
gives:
Code:
a.flac

Whereas the result I expect is:
Code:
a
Why is it not working, and how do I make it work?

View 3 Replies View Related

Programming :: C++ Multiple Variable Declaration Error - Even After I Set #ifndef Preprocessor

Jan 18, 2011

Why do I still get mutiple definition of "_my_variable" error even after I used the #ifndef preprocessor in my hpp file?

This is my scenario
I have:
1. A.cpp (including X.hpp)
2. B.cpp (including X.hpp)
3. X.hpp

[Code]...

View 4 Replies View Related

Programming :: Assigning Structure Object's Variable Outside Main() Gives Parse Error

Sep 2, 2010

Kindly take a look at the code below :

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.

View 7 Replies View Related

Programming :: Bash - Read Content Of File To Variable And Use This Variable In For Loop ?

Aug 21, 2009

I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.

For example:

Code:

Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).

View 6 Replies View Related

Programming :: Make A New Variable With The String From The Old Variable Btut Without Any Plus Sign?

Apr 7, 2010

my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.

i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't

foo=+12.40
bar=${foo#+}

View 4 Replies View Related

Programming :: Search Within A Variable And Assign The Results To A New Variable?

Apr 25, 2011

how I can search within a variable and assign the results to a new variable. I'll use the following as an example -

cars="Audi BMW Cadillac Chevy Dodge Ferrari Ford Mercedes"
list=`echo ${cars} | egrep -o '<A?+|<C+'`

with the echo command I get the following output assigned to list -

A
C
C

What I'd like to get for output is -

Audi
Cadillac
Chevy

how I could do this regardless of upper/lower case letters?

View 5 Replies View Related

Programming :: Assign Value Of C Variable To Shell Variable?

Apr 28, 2010

included shell script inside c program, and i wanted to assign the value of c variable to shell variable..Can any one please suggest me how to do it?

View 8 Replies View Related

Programming :: Assignment To A Variable Variable?

Mar 17, 2011

This loop is part of a bash script which takes multiple arguments.

Code:
for ((i=1;i<=$number;++i)) ; do
offset=$(($i+5))

[code]...

View 3 Replies View Related

General :: Sed: -e Expression #1, Char 27: Unterminated `s' Command

Feb 3, 2011

I am trying the execute the following

#!/usr/bin/python
import os
os.system("sed -e 's#^(.*) (.*)0http://12#' t2.txt > t3.txt")
os.system("cat t3.txt | sort | uniq -c | sort -rn | head > t4.txt")

But I receive the following error message.

sed: -e expression #1, char 27: unterminated `s' command

View 1 Replies View Related

Programming :: Pass Variable In Mysql Qyery In C Programming?

Dec 4, 2010

i want to pass variable in mysql qyery in c programming

View 1 Replies View Related

Programming :: Created First Little Program In C++ That Im Happy About?

Sep 4, 2010

Code: //Author: Donald Farkas
//Created: Sep/4/2010
#include <iostream>

[code].....

View 6 Replies View Related

Programming :: Looking For Last Five Files Created On Hard Disk

Aug 4, 2010

Kernel 2.6.21.5, GNU (Slackware 12.0).
Bash 3.1.17.

I want to search an entire subtree of /, in the file system, for all files, with extension html, created on the hard disk. In addition, these have to be the last five created. I think I could split the problem into two parts: (a) Forget about the last condition. Then this is a job for the find command. (b) Sort the output of find using the date as the key, then use 'head' to print the desired output. But even two such simple steps are enough to justify the writing of a shell script. And here lies my weakness.

My script writing knowledge is rudimentary. What's the final purpose? Well, I lately saved four or five LQ pages onto disk containing information I consider valuable to me. But I don't exactly remember where on the disk. Then: either the problem posed is really of a very simple nature or it is not, in the latter case a script being mandatory. One of the algorithm drawbacks (the one described above) is that find may be running a great deal of time. My machine resources (RAM and CPU speed are low) are scarce and there possible are a large number of HTML files on the disk.

View 8 Replies View Related

Programming :: Created A File With A Pre-defined Size ?

Feb 19, 2010

I have created a file with a pre-defined size as follows:

Code:
#define FILEPATH "testfile"
#define FILESIZE 16

[code]...

View 5 Replies View Related

Programming :: Created Python Programs - Making Changes To Improve?

Dec 17, 2008

I have list of programs which I have created during the past few days, all the programs are attached in txt files, and if anyone can do favor, and double check if they work, and what changes I can make to make it look different, or to improve it.

View 9 Replies View Related

Programming :: Make Objects Created With New Garbage-collected

Apr 30, 2011

I read this guide: [URL].. but I still don't understand how to make objects created with new garbage-collected. Could someone explain how or find a link to an explanation?

View 13 Replies View Related

Programming :: Created A Script To Flush Sendmail To Another Mailserver?

Jan 7, 2011

I created a script to flush my sendmail to another mailserver. Because it takes some time I want to give some simple feedback using a rotating bar.

Code:

I'm convinced this can be done much nicer with 'awk' and printf, but somehow awk makes me dazzle..

View 1 Replies View Related

Programming :: Know Which File Under The Folder Is Being Opened / Created For Writing?

Apr 23, 2010

My program need to monitor the foler to know which file under the folder is being opened/created for writing. I add the folder into watch list using inotify_add_watch, when a file -- say 'AA' -- is created, I'll get the event through read api call. But the inotify_event only have file name 'AA' and a event mask. these parameters can't help me to know how the 'AA' is created/openned. So I have to scan the /proc folder to get to know how is 'AA' created/openned. I don't think this is a efficient way, especially if there are lots of files are openned/created in a short time span.

View 3 Replies View Related

Programming :: Hosting New Gtk RGBA Module Created On Launchpad?

Mar 9, 2010

[URL] Essentially, this module can be fine-tuned to the user's liking, using four integers instead of a boolean. By allowing for the red, green, blue, and alpha values to be fine-tuned, the user can control how transparent or opaque their desktop is. And how is this possible? C++ instead of C. How do you guys think of being able to customize RGBA?

View 14 Replies View Related

General :: Binary Is Not Created Without Giving Error?

Jul 13, 2011

and executing my package on red hat version 2.6.18-164.el5 and displaying no error but my binary is not created what could be problem ??

make[1]: Leaving directory `/root/kartik/POC_SSI_1/iub_dogw/ipr/common/cspl'
gcc -print-file-name=libgcc.a -g -Wall -Werror -D_GNU_SOURCE -r -o /root/kartik/POC_SSI_1/iub_dogw/bcpapp/../bin/x86_64-redhat-linux/bcpapp/bcpapp -lgcc -lc /root/kartik/POC_SSI_1

[code]...

View 2 Replies View Related

Programming :: Shell Script To Monitor Files Created On A Folder

Aug 27, 2009

Can someone please help me on how can i create a script that will monitor file creation on a single folder and sending the newly created file on a separate folder? Only the new created file must be transffered or copied to the other folder. The old ones remains.I urgently need this for production deployment.

View 8 Replies View Related

General :: Make Install Error With Created Makefile

Jun 3, 2011

I am new to Linux and I am trying to install a C program from source using Makefile. So I 've created a "hello world" program and then a Makefile to install it. Then I logged in as root and used
make install

The following error occurs:
make: execvp: /usr/bin: Permission denied
make: *** [install] Error 127

Here is the Makefile:
CC=gcc
CFLAGS=-c -Wall
PROGS = hello
INSTDIR = $(prefix)/usr/bin/
INSTMODE = 0755
INSTOWNER = root
INSTGROUP = root

all: $(PROGS)
$(PROGS): main.o
$(CC) main.o
main.o: main.c
$(CC) $(CFLAGS) main.c
install:$(PROGS)
$(INSTALL) $(INSTDIR)
$(INSTALL) $(INSTMODE) $(INSTOWNER) -o $(INSTGROUP) $(PROGS) $(INSTDIR)
clean:
rm -rf $(PROGS) *o $(PROGS)
So, where are the errors

View 3 Replies View Related

Programming :: Sed A Variable In Bash?

Mar 25, 2011

I have beat this enough and don't get what should have been a very simple thing to do. I build a variable;

Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I

[code]...

View 2 Replies View Related

Programming :: C++ Get Variable Name From Document Name?

Apr 9, 2010

How would I go about defining a variable from a document name. Example:document01.doc I want to take the 01 and set X to equal integer 1.

View 1 Replies View Related

Programming :: Defining Variable With Sed?

Jun 2, 2010

I need to replace JAVA_OPTS= with JAVA_OPTS=<some_value>.I need to give "" value at the end of the replacement. I have tried with the following but it is not working: sed -e "s|JAVA_OPTS= |JAVA_OPTS=<some_value>"

View 2 Replies View Related

Programming :: Can Awk Take A Shell Variable

Jul 23, 2010

I have been searching most of today and am stuck on getting a variable into an awk portion of my bash script. I have this working:

Code:

#!/bin/sh
SRC=/var/log/mail.log
DEST=/var/www/output/myFile.txt
VAR=userName@myDomain.tld

[code]....

Can awk take a shell variable? Or do I have to do something completely different?

View 11 Replies View Related

Programming :: C++ Variable Type Followed By *?

Jul 1, 2010

In C++ what does the suffix, "*" mean appended to a variable type, e.g., "char* variable1;"?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved