General :: Modify Loop Code (For And While) To Get Output Returned

Jul 20, 2010

Filename.txt

Code:
My First Line
My Second Line
::::While Loop:::
Program:

Code:
while read line
do
echo "$line"
done < Filename.txt
output:

Code:
My First Line
My Second Line

Is it possible to use for loop to get the same output. I have tried executing below code but I get every word of my file being displayed one below above.Is there any way I can modify the for loop code to get the output returned by while loop?

:::For Loop:::
Program:

Code:
for line in $(cat Filename.txt)
do
echo $line
done
output:

Code:
My
First
Line
My
Second
Line

View 8 Replies


ADVERTISEMENT

General :: Modify The Output Of Df Command?

Mar 20, 2010

this is the output of df command on my system

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 18073924 4911628 12244184 29% /
udev 642140 308 641832 1% /dev

[code]....

View 14 Replies View Related

General :: Feeding A While Loop With A Command Output?

Apr 25, 2011

I am posting this just for the sake of curiosity. I am trying to feed a while loop structure with a command output, but using the bash built-in I get the error "ambiguous redirect":

Code:
while read line
do

[code]....

View 4 Replies View Related

General :: "Sub-process /usr/bin/dpkg Returned An Error Code - 1"

Feb 17, 2010

Since I'm quite new to Linux I wonder what "Sub-process /usr/bin/dpkg returned an error code (1)" mean ?? Is it RTFM/read the damn logs at /var/log or does someone have an answer to this ?

View 1 Replies View Related

Debian :: Dpkg Returned Error Code (1)

Jul 25, 2015

When trying to install php5 I got the following result. Tried to apt-get clean, autoclean, remove --purge then reinstall the mentioned packages without any success.

dpkg --configure -a didn't get any better result.

Code: Select allsudo apt-get install php5
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets supplémentaires suivants seront installés :
  libapache2-mod-php5 php5-cli php5-common

[Code] .....

View 5 Replies View Related

Ubuntu :: Sub-process /usr/bin/dpkg Returned An Error Code (1)

Jan 14, 2010

I think that my computer crashed one time, while I was in middle of installing some new software, and it seems like it have made "dpkg" confused with itself - it thinks, that I still need to install "Wine", but it is allready installed, so everything is allright. But everytime, when I am upgrading or installing any kind of software, it give me this error (just an error, everything still works and installs fine):

Code:
Setting up wine (1.0.1-0ubuntu8) ...
kernel.printk = 4 4 1 7
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1

[Code]....

Errors were encountered while processing: wine E: Sub-process /usr/bin/dpkg returned an error code (1)

View 6 Replies View Related

Ubuntu Installation :: /usr/bin/dpkg Returned An Error Code (1)?

Mar 19, 2010

I'm tried to install bandwidthd on Ubuntu 9.10 and keep getting the following error.I have been looking around for a while and have been unsuccessful in finding a answer.

HTML Code:
$sudo apt-get install bandwidthd
Reading package lists... Done

[code]....

View 1 Replies View Related

Software :: E: Sub-process /usr/bin/dpkg Returned An Error Code (1)

Jan 30, 2010

I'm trying to customize my BackTrack4 image so I can use the live disk with my ati graphic card. While trying to put the drivers with the apt-get install ati-driver command, I get the following message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
ati-driver

[Code]....

View 2 Replies View Related

Ubuntu Installation :: E: Sub-process /usr/bin/dpkg Returned An Error Code (1)

Mar 13, 2010

Thought I could just place a hard drive with a preloaded Ubuntu install from another machine (a loaner machine) into this one; change a few drivers and be on my way. Too many errors to count. ALSA; Jack; LiveTex all cratered and I'm tired of fighting this. I've spent more than two days trying to get stuff working and if there's anything I've learned from years of experience there's a time to cut bait and run.

A clean install on the actual hardware I'm using has to be better than the hodge podge I have now.What I would like from the community is recommendations for what to do AFTER the install.

1) where can I find the most up-to-date comprehensive and exhaustive list of repositories for the Synaptic Package Manager?

2) I like to do sound and video processing. I would like to have the program applications
Qsynth, Virtual Midi Keyboard, Muse Score, Csound, GNU Denemo, and many others that either fail to start or produce no sound to work. What, besides the programs need to be loaded in order to make these work?

3) A helpful list of recommendations on what to install along with order preference. In other words 'this needs to be done before this...' on a new Ubuntu install.

In case anyone's interested: Here's a small list of some of the errors I currently have.
AlsaModularSynth - Could not open file.Qsynth1 - Failed to create the audio driver (jack) / Jack server not running.

Errors were encountered while processing:

texlive-latex-base-doc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Qtractor - The audio/MIDI engine could not be started. Make sure the JACK audio server (jackd) and/or the ALSA Sequencer kernel module (snd-seq-midi) are up and running and then restart the session.

apt-get install alsa-utils - Errors were encountered while processing:
texlive-latex-base-doc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Jack configuration files not found; the list is endless. Plus many errors trying to get texlive to work.

View 1 Replies View Related

Ubuntu :: Build Failed - Sub Process Returned Error Code

Sep 24, 2010

The problem emerged when I started to make the internal microphone and external speakers work [URL]. In either kernel 2.6.32-24 or 2.6.35-15 - cannot install any package with apt-get. Here is the error I get when installing just anything [URL]. Basically, here is it:

Code:
ERROR: Build failed. Please review the build log at /tmp/alsa-driver-linuxant.3620.log
dpkg: error processing alsa-driver-linuxant (--configure):
subprocess installed post-installation script returned error exit status 2
Setting up libxslt1-dev (1.1.26-1ubuntu1) ...
Errors were encountered while processing:
alsa-driver-linuxant
E: Sub-process /usr/bin/dpkg returned an error code (1)

View 3 Replies View Related

Ubuntu Installation :: /usr/bin/dpkg Returned An Error Code (1) Kernel

Dec 1, 2010

Code:
Unpacking replacement linux-image-2.6.35-23-generic ...
dpkg-deb (subprocess): data: internal bzip2 read error: 'DATA_ERROR'
dpkg-deb: subprocess <decompress> returned error exit status 2
dpkg: error processing /var/cache/apt/archives/linux-image-2.6.35-23-generic_2.6.35-23.41_i386.deb (--unpack):

[Code].....

both update software and synaptic gave the same error? how do i install this package?

View 1 Replies View Related

Ubuntu Servers :: E: Sub-process /usr/bin/dpkg Returned An Error Code (1)

Dec 19, 2010

I have a little home server running server 8.04 and decided to check for upgrades. One of the upgrades was a new kernal update. It was able to download the update, but errors on uncompressing it. I have even shutdown the server and restarted it. Still no luck.

Here is the screen log from the update process:

(Reading database ... 49993 files and directories currently installed.)
Preparing to replace linux-image-2.6.24-28-server 2.6.24-28.80 (using .../linux- image-2.6.24-28-server_2.6.24-28.81_i386.deb) ...
Done.
Unpacking replacement linux-image-2.6.24-28-server ...

[code]....

View 1 Replies View Related

Ubuntu Installation :: E: Sub-process /usr/bin/dpkg Returned An Error Code (2)

Apr 8, 2011

when i try to update using terminal and update manager i get this error

/usr/bin/dpkg: 1: Syntax error: "&" unexpected
E: Sub-process /usr/bin/dpkg returned an error code (2)

View 7 Replies View Related

Ubuntu Multimedia :: K3b Burning - Errors CD RECORD RETURNED AN UNKNOWN ERROR (CODE 254)

Aug 14, 2010

Iam trying to burn wave files to a cd that i ripped from a cd when i try burning to gets to 300 meg and stops with these errors CD RECORD RETURNED AN UNKNOWN ERROR (CODE 254) SOMETIMES USING TAO WRITING MODE SOLVES THIS ISSUE Using ubuntu 10.04

View 1 Replies View Related

OpenSUSE Install :: Passwd -S Output \ Ran The Command But Nothing About The Algorithm Is Returned?

Mar 23, 2010

I read that passwd -S spits out informationabout a user's password including the encryption algorithm used to encrypt the password in /etc/shadow. I ran the command but nothing about the algorithm is returned. Is this a quirk in openSUSE?On another note, I've determined through other means that I've selected blowfishryption as evidenced by the $2blah$2blahblah format of the /etc/shadow entry. However, if I look at /etc/default/passwd it lists CRYPT=md5. If I'm using blowfish why would that variable be set to md5. onversely, if it is set to md5 why is the blowfish algorithm being invoked?

View 4 Replies View Related

Programming :: Trying To Modify Code For GBLink?

Apr 12, 2010

I'm trying to modify the code for gblink so that it can read from my usb to parallel port cable. I know that the address for a normal parallel port (/dev/lp0) is 0x3bc, but how can I find out the address for /dev/usb/lp0?

View 6 Replies View Related

Ubuntu :: Modify The Source Code Of The Kernel?

Oct 4, 2010

I want to modify the source code of the kernel so that the new compiled kernel should disable USB ports.

View 4 Replies View Related

Networking :: Modify Ftpd Source Code To Work With Xinetd?

Sep 23, 2010

I read that xinetd listens on the service port and passes incoming traffic to the service (ftpd) via stdin. However, the ftpd source code reads its input from a socket not from stdin.

Am I to conclude that in order to be managed by xinetd, the source code for ftpd (or telnetd etc..) must be modified or recompiled to take its input from stdin??

View 1 Replies View Related

Programming :: Using Sed To Modify Command Output?

Jun 13, 2010

The output of a command changed and I need to extract the data and print it out in a different fassion:

Code:
abcd1=aaaa xx
abcd 2 aaa xx bbb
abcd2=aaaa xy
ab 2 xx aaa bbb ccc xxx
should be transformed to:

[Code]...

Currently I used sed "search1|search2|search3" to get the lines that need to be transformed. But I also need to search for substrings in those lines and I need to print those substrings in a specific order together with other characters. How is this done with sed?

View 7 Replies View Related

Programming :: Modify Output Of Shell Script

Dec 3, 2010

I'm running RHEL5.5 and nagios 3.2.0. The real question deals with how to change the printed output so nagios will work with it.I have made a script that will calculate network throughput on interfaces. The script is going through and finding all interfaces (eth, bond, lan) and doing the math to calculate throughput.The output is mainly for nagios to report and trend the values. As nagios wants to see nothing but perf data after the '|' character, I somehow need to have only one '|' character for all of the output.

View 2 Replies View Related

Ubuntu :: Port A Command Output To A While Loop?

Oct 3, 2010

How can I port standard out from ls or any other command into a while loop?

Code:
while read line
do

[code]....

View 4 Replies View Related

Programming :: Sed In A Bash Loop With Ascending Output?

Jan 1, 2011

I have a file like below:

PU12829,24869;PD15733,24869;PD15733,19785;PD12829,19785;PD12829,24869;
PU4599,20915;PD9924,20915;PD9924,18898;PD4599,18898;PD4599,20915;
PU12829,24869;PD15733,24869;PD15733,19785;PD12829,19785;PD12829,24869;
PU4599,20915;PD9924,20915;PD9924,18898;PD4599,18898;PD4599,20915;
PU1723,3423; #this line is ignored to short

[Code]...

What I'm trying to do is while true, cut each line from file that begins with PU and thats longer than 12 characters and write to a increasing numbered file for each line. Stating with object1 etc.

View 14 Replies View Related

Ubuntu :: Error - Failed To Save File ImageMagick Returned Error Code 11 Command Line

May 1, 2010

simple scan error as follows: Failed to save file ImageMagick returned error code 11 Command line: convert -adjoin /tmp/simple-scan-DA9MBV.jpg /tmp/simple-scan-XCK4BV.jpg /tmp/simple-scan-NZVYBV.pdf Stdout: Stderr: using karmic note: I have apparmor extra profiles installed but didn't notice one that related to simple scan or imagemagick. Red herring or not?

View 6 Replies View Related

Ubuntu :: Error - E - Sub-process /usr/bin/dpkg Returned An Error Code - 1

May 9, 2011

I have just upgraded my ubuntu to 11.04 .After it is done ,I could install any software ,the error is as follows:

E: Sub-process /usr/bin/dpkg returned an error code (1)

I wonder what is the meaning of the error.

View 3 Replies View Related

General :: For Loop Or While Loop To Read The Fields Of A File?

Sep 1, 2010

I have a mytext file with month and year as two separate fields. likemytext fil

08 2010
09 2010
10 2010
........
........
........

I want to read the values of each field i.e., month and year into an awk script.

View 10 Replies View Related

Programming :: Nested Loop Using A Counter To Increment Array Output?

Feb 2, 2011

I work in a simulations environment. I'm trying to write a bash script that will read fields from a .csv file into an array, the first field being an identifiyng number and the second field being a corresponding url. There are about 1600 of these number/url combinations in the .csv file that i'm reading from. Once that is done i want it to parse a text file and match the number, when it has a match i want it to enter the corresponding url into a particular line in the text file. The script I have written (with the help of the people on this forum a while back) does this well, but now I have a lot more data to parse. I think the script itself is explanatory enough to see what i'm doing. What i would like to do is cut it down to one while loop nested inside another loop so that I don't have 1600 or so elif statements. I can't figure out how to increment the output of the array. for instance, the first cycle would find the number that matches ${record1[2]} and input the url stored in ${record1[3]}. the next cycle would match ${record1[4]} and input the url in ${record1[5]}, and so on, does that make sense? The code is below and a sample .csv and text file are attached.

[Code]...

View 14 Replies View Related

Server :: PHP5 And Apache2 Parsing Code But No Output?

May 2, 2010

I have apache 2.2.3 installed with php5 and libapache2-mod-php5. The server displays web-pages fine, but when I try to load a .php file, nothing shows up. There aren't any errors, not in the browser and not in the Apache2 error logs... just nothing shows up. When I look at the page source on the browser, all the HTML code is there, but all the PHP code is gone, as though it was parsed. I can't get any output to show up though, echo and print both do nothing.What could be the problem?Example:

Code:
<html>
<body>

[code]...

View 7 Replies View Related

General :: Nfs :RPC Call Returned Error 101

Feb 23, 2010

i am trying to run an application code in nfs host.but facing the problem as shown below.can anybody tell what the problem could be?

[code]...

View 2 Replies View Related

General :: Pthreads - Structure Can Be Returned With Value

May 21, 2010

I am playing around with pthreads. This program however blows up.

#include <iostream>
#include <pthread.h>
using namespace std;
struct myStruct
{
int a;
string msg;
};

void * myProc(void *arg)
{
struct myStruct* str = new struct myStruct();
str->a = 10;
str->msg ="hi";
return (void*)str;
}

int main(int argc, char **argv)
{
pthread_t mythr;
int status ;
void *retVal;
struct myStruct* m_str;
status = pthread_create(&mythr,NULL,myProc,NULL);
status = pthread_join(mythr,&retVal);
cout<<"Status is"<<status<<endl;
m_str = (struct myStruct*)m_str;
cout<<"retval is "<<m_str->a<<" "<<endl;
return 0;
}

Can a structure be returned by a thread as its return value ?

View 1 Replies View Related

General :: Edit All The Files Returned By Find In Vi?

Sep 15, 2011

Something I find myself doing a lot is running a find command and then editing all of them in vi, which looks something like this:

> find . "*.txt"
./file1.txt
./file2.txt
./path/to/file3.txt
> vi ./file1.txt ./file2.txt ./path/to/file3.txt

Is there a clever & simple way to do this all in one command line?

View 3 Replies View Related







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