Programming :: Sed Terminated Prematurely By Presence Of C In Input

Jun 17, 2011

Sed seems to react to the presence of "" in its input if the immediately following character makes the pair a recognizable code. In the code following see that the "a" and "" are missing in the output, and that the "c" caused sed to terminate at that point. Is there any way to prevent it reacting like this?

Code:
g y="the shell built-in command. The following character sequences
> have special meaning:
> a Alert (bell).
>  Backspace.
>
> c Suppress trailing newline.
> f Form feed.
>
[Code]....

View 3 Replies


ADVERTISEMENT

Programming :: Read The Presence Of A Blank Line In Gcc?

Apr 20, 2010

in gcc how to read a blank line ie a string of length 0.

my code: Code:
#include<stdio.h>
#include<string.h>
#include<string>
using namespace std;
[Code]....

View 4 Replies View Related

Programming :: Check The Presence Of USB Using /proc Interface In A C Program

Feb 22, 2010

I want to check whether a USB is plugged in its slot from a C program. I want to make use of /proc interface for the same. During my reading i found that /proc/bus/usb/devices will tell how many USB devices are currently present.

So whether i can open this file and use stat call to identify whether the size is 0. If size is 0, i can assume no USB present. Else i can assume USB is present.

Whether my understanding correct. If USB inserted, how can i check the folders present in the USB stick.

View 2 Replies View Related

Programming :: Write Script To Look For The Presence Of Memory Allocation Calls Without Corresponding?

May 14, 2011

I need to write script to look for the presence of memory allocation calls without corresponding calls to free the memory

View 5 Replies View Related

Programming :: Shell Script Terminated After FTP Transfer

Dec 28, 2009

I made a shell script with the following piece of code to transfer some files via ftp:

Code:
echo 'before ftp'
ftp -n $FtpHost << EOF
quote USER $FtpUser
quote PASS $FtpPasswd
quote CWD $FtpDir
put $FileNameLog
put $FileNameSqlTarSum
put $FileNameSqlTar
put $FileNameWwwTarSum
put $FileNameTar
quit
EOF

echo 'before rm'
rm $FileNameWwwTar $FileNameWwwTarSum $FileNameSql $FileNameSqlTar $FileNameSqlTarSum $FileNameLog
echo 'after rm'

The problem is that the script ends after the "quit" command in FTP, so code after it won't run, like the remove of temporary files. If I remove this "quit" command, the shell understands I'm still parsing commands to FTP, although being after the EOF. I used this echo commands to check which parts of the script are running.

View 7 Replies View Related

Ubuntu :: Firefox Downloads Stopping Prematurely?

Jan 10, 2011

I have a fresh install of ubuntu 10.04 lucid .... When I went to download some files via firefox, I noticed that the downloads would stop before the download is complete. I tried to download a small 8MB file and it reached almost 4MB then the download simply stopped and firefox incorrectly informed me that the download was finished.. I tried several more downloads after that of various other files and the same thing happens. I have never had trouble downloading files before. I upgraded to firefox 3.6.13 before I noticed this problem so I do not know if it was doing it before I upgraded as this is a fresh ubuntu install.

View 2 Replies View Related

OpenSUSE Install :: Installer Terminates Prematurely - Error 15

Dec 23, 2010

I tried to install 11.3 today but no luck so far. I installed it 3 times from GNOME liveCD and once from a LiveUSB both didn't work. With the CD, it restarts before installing initrd, GRUB tells me :
error 15 : file not found.
I verified both the image I downloaded via md5 and the CD I made and they both are OK.

View 9 Replies View Related

Programming :: Shell Programming - Delete User Input

Jan 21, 2011

I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.

Do i have to use sed command?

View 4 Replies View Related

Programming :: Input And Output On C++ Programming ?

Jan 28, 2010

As i am new to C++ i couldn't figure out how to input a file and make some change on the file and produce a output file. like this problem i have is.

"Program that processes an input file and produces an output file. The input file will contain lines of data, each containing two floating point numbers. The lines of the output file should contain the two numbers read and their average (with a '$' sign and 2 places after the decimal point)."

View 2 Replies View Related

Ubuntu Installation :: Rosetta Stone Application Installation Ends Prematurely

Jan 24, 2010

I'm trying to install the Rosetta Stone v3.3.5 for Ubuntu 9.1 and here's what happens. I open the RosettaStoneSetup.exe with Wine and after the files extract and I agree to the terms the installation starts. The progress bar fills to the end and then I get a popup telling me that the installation ended prematurely.

View 2 Replies View Related

Programming :: Get Input Without The Terminal?

Apr 1, 2010

I've done a little program, it's the snake game. I use an X window to show the snake and all that but the input is taken from the terminal. That means that what I have to do to play the game is open it with the terminal and then the game opens but then I have to go to the terminal again to move the snake. if I open the game from the GUI I can't do anything because it doesn't take my directions. What do I have to do in order to get the program to have a connection with my keyboard? I use getchar() to get the input, maybe there is something else?

View 9 Replies View Related

Programming :: Get Input From Entry Using Gtk?

May 2, 2011

I'm trying to make a program to simulate a parabolic movement, so i've added 2 entries, one for the initial velocity and other for the angle, anyway you probably don't care about that xD what i want is to take the number entered in the entry and put it in a variable to do the math, and then show everything in a dialog or something. how do i do that?

View 3 Replies View Related

Programming :: Can Diff Take Arrays As Input

Jun 19, 2010

Does diff not like arrays? How do achieve the following?

Code:

stuart@stuart:~/music transfer$ diff file1.txt file2.txt
1c1
< bonkers_in_phoenix.mp3

[code]....

View 14 Replies View Related

Programming :: Checking Input Is Numerical?

Jan 18, 2010

what i am trying to do is to allow the user to key in data such as "23.23" or "24" , as it is the price of certain objectsHow am i able to design a check which will allow me to prevent users from typing in input such as "ab.21" or "rfrr" as this field is purely a numerical field. The problem i am facing is i tried using this search code.

Code:
echo "read this"
read this

[code]....

View 14 Replies View Related

Programming :: How Sed Can Catch Variable From Input?

Feb 2, 2011

right now i am writing bash script for simple everyday todo tasks.script consisit of two files, fisrt is just script (which can delete/append /clear) and second one is todolist.txt which stores my notes.I am litlebit confused about sed!!for example, If my todolist.txt have these lines:

- Writing my Homework
- take my girlfriend to launch
- Take a break

How can sed take my input $@ and delete all line with name "Homework"..i trayed with many sed combination like:

Code:
sed s/$@//g
sed 'd/$@/'
and many more combination with ""/'' or bracket but nothing helped

View 5 Replies View Related

General :: Hide The Presence Of A File By Modifying The Gid/uid?

Jan 8, 2011

Whether we could hide the presence of a file by modifying the gid/uid?

View 1 Replies View Related

Ubuntu Installation :: Does Not Detect The Presence Of CdROM

Jun 8, 2011

I have just had my Ubuntu 10.04.2 Luci installed under my Windows OS. Things seem to be fine until I find out next that my copy of Ubuntu does not detect the presence of the cdROM which installed the software itself on my desktop machine.

I have tried searching high and low for clue in this forum, tried all the recommended tricks to find out at last that there is no cdROM listed under my DISK UTILITY and when I input the following comman,

sudo lshw -class disk -class storage I only happened to see my hard drive and some USD drives being listed.

Also, Brasero Disc Burner does not detect the presence of a cd/ DVD rom devices.

View 2 Replies View Related

General :: Find Qlogic NIC Card Presence?

Jul 5, 2011

We had a problem with the NIC 10Gig Qlogic NICs and had to swap them with Emulex 10Gig NIC cards. The swap has been done. There are several severs (about 100)for which we need to check if the hands-on still left the q logic card in them. So, I wrote a script using dmesg and grepped for "qlogic" or " NC522SFp" and my script checked for all the servers and returned no presence of "qlogic". But few of them have q logic still in them. So, is there any other way through which we can exactly tell whether q logic card is still present or not? I used:

dmesg | grep -i "qlogic" or
dmesg | grep -i " NC522SFp"

and found nothing in the o/p. But when I checked using ifconfig -a, then I see the q logic mac ids for eth4 & eth5, which means the Q logic is still present.But not sure whether ifconfig is the real way to find out the presence of these cards.

View 1 Replies View Related

Debian Programming :: Serial Input In Scripts

Jun 10, 2013

I need a way to use serial input such as through an Arduino in Debian scripts, in any usable language.

View 2 Replies View Related

Programming :: User Input Bash Script

Apr 28, 2010

I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?

Here's the script:

Code:

View 4 Replies View Related

Programming :: C++ Cin Doesn't Wait For Input By Operator

Jan 4, 2010

I am trying to learn C++.I implemented a simple archive program, and I am in a situation in which the user is prompted by a menu to make a choice.So I have some cout instruction to illustrate the possible choices and then

int choice;
cin>>choice;

and everything works fine.I introduced this code in a "while" loop that checks wether the choice made by the user is valid or not:

bool check=true;
int choice;
while(check)
{
cin>>choice;
if(the choice is valid) {...;check=false}
else cout<<"please make an other choice"
}

What is happening is that if by mistake the user introduces a character in place of a number, the loop repeats indefinitely because the program, when it get to the "cin" instruction, does not pauses to wait for a new input.

View 7 Replies View Related

Programming :: C - Check If An Input Char Contain Numbers?

Mar 19, 2010

I would like to create a small C tool. I encounter a problem of how to make a function to check an input chars contains numbers (started from the second element).

Some samples:

char *mychar= "a3547"; (The result of function checking this is true)
char *another_char = "t6548"; (The result of function checking this is true)
char *next_char = "appl3"; (The result of function checking this is false)
char *new_char = "b1aa3"; (The result of function checking this is false)

View 4 Replies View Related

Programming :: C Program To Get Input Of Array And Output It

Aug 14, 2010

I am creating a 15 integer array which is input from the user and outputted for the.

Ex.
Enter the array values: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Your values are: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Code:

View 4 Replies View Related

Programming :: C - User To Input The Name Of A File As An Argument

Aug 5, 2010

Write a program that requires the user to input the name of a file as an argument. If the user fails to include one argument it should make use of a thread that handles a signal. The signal handler should tells the user Incorrect number of arguments and then calls the terminate signal on the process.

If the numbers of arguments are correct then the program should allocate memory space to the file (5MB) and create a child process that requests the user for a character that it should send to the parent. The child should keep request for data until the user keys in the character O. During each request it should pause for 10 seconds, send the character to the parent and then requesting again for another character.

The parent should get the character from the child. Do not make the parent wait for the child to finish requesting for data. Make use of pipes to facilitate communication between the parent and the child. A second child should be created to read and display data from the file. Make use of any appropriate Inter Process Communication technique to ensure that the second child and the parent do not access the file simultaneously (Mutual exclusion).

View 5 Replies View Related

Programming :: Checking Of Input In Roman Program?

Apr 11, 2010

i have to write a program which checks the information inside a text file to make sure it is all integers and then convert the integers to roman Numerals. My program seems to have a bit of a problem and im not sure where exactly the problem is....

Code:
#include<stdlib.h>
#include<string>

[code]....

View 8 Replies View Related

Programming :: Giving Output Of A Command As The Input To Another

Sep 7, 2010

While making a shell ,there is the following problem Im facing:

I am expecting the user to enter commands in the following format :

I am to separate these and the output of ls -l should be given as input to grep and the output of both to more.

But I am allowed (by our instructor) to use dup/dup2 or any other command(but not pipe or tees).

How to connect the file descriptors after successful execution of each command?

View 5 Replies View Related

Programming :: Passing Input To Program For Test

Apr 13, 2011

I started to run a C++ my program in Linux and I don't know how to test my program that works fine with a text file. This is a project for my uni and to explain more clear, My program is a sample database for modify or add and search and it read data from a binary file and also write into a binary file. I have got an input from my lecture and she said after compiling in Linux I must write:

1-to compile:
Code:
g++ (files with cpp)
2-to see the output:
Code:
./a.out
3-to test with input:
Code:
./a.out < input.txt >

My problem is in step three. What I must write in the command part after" step2" to see the output?

View 3 Replies View Related

Programming :: Watch For Keyboard Input Without Waiting In C?

Jan 25, 2011

I have a C program that may finish in seconds or weeks depending on the data. For the longer jobs I want to be able to press a key and get an intermediate result printed.

View 14 Replies View Related

Programming :: Input Redirection While Setting Password

Apr 26, 2010

I have this piece of code in my shell script file:
Code:
useradd $UserName; passwd <& $password
I am not able to perform Input Redirection while setting password programatically- without any user intervention.
I think there is a way to do it, but it is just getting slipped from my mind at the moment.

View 2 Replies View Related

Programming :: Select The Branch Based On The INPUT?

May 23, 2011

I want to select the branch based on the INPUT. Here is the program segment which uses the case statement.

case $INPUT in

1)branch="Computer Science";;
2)branch ="Electrical";;
3)branch = "Mechanical";;
4)branch= "Aerospace";;
esac

When I run this script, I am getting an error, Electrical command not found?

View 2 Replies View Related







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