Programming :: Sed Strange Behaviour With Line Including Backslash?

Jul 1, 2010

I have a small script that takes input from one file, and uses this input to do a find/replace (with sed) to make an executable snmp trap.The input file could look something like this :JOHBURG SOUTH AFRICAOSLO NORWAY..etcThe script takes the input from this file, and preserves all words in one line as a variable (so that the variables are "JOHBURG SOUTH AFRICA" and "OSLO NORWAY", instead of JOHBURG, SOUTH, AFRICA, OSLO, NORWAY.This is working ok (in the given example, I get two variables).sed is supposed to take this variable, and use it to substitute "HITME" with the new variable.

#!/bin/bash
N=0
cat tutticodes | while read LINE

[code]....

View 21 Replies


ADVERTISEMENT

Ubuntu :: Keyboard Number Keys On The Right Side - Including Backslash - Plus - Minus Stopped Working And Mouse

Mar 23, 2011

1) Keyboard number keys on the right side, including backslash, plus, minus, etc. stopped working. The rest of the keyboard seems okay. It's not just this keyboard, either, because I plugged in my other keyboard and it has the same problem.

2) My mouse seems to have an intermittent problem in which it stops working for a few seconds or a minute. I can move it around the screen but I'm not able to click on anything. Sometimes if I wait long enough, it returns to normal. If I logout using the keyboard commands and log in again, it seems okay, at least until the next occurrence.

I'm running 10.04 LTS Lucid Lynx. I installed a kernel update a couple of weeks ago (2.6.32-29) but I've gone back to -28 in the hope that it would solve the problem. It has not. Is there a software package I need to reinstall or some other way to revert keyboard and mouse settings to defaults?

View 4 Replies View Related

Ubuntu :: Rename Strange Behaviour After Upgrade To 10.10?

Oct 16, 2010

Today I upgraded from 10.04 to 10.10 and I notice that the rename function is different from before.
Now it select all the filename including the extension while before it select only the filename. How can I fix this problem? It's very uncomfortable rewrite the extension everytime or remove the extension from the selection.

View 6 Replies View Related

Ubuntu :: USB External Disk Strange Behaviour?

Jul 19, 2011

Whenever I remove my external Freeagent Go USB external harddrive my mouse and keyboard stops responding and all I can do after that is hard-reboot pressing the key on the cabinet.It happened when external harddrive was connected while a powercut, though drive works fine when ever I disconnect it mouse and keyboard stops functioning and I have to hard reboot machine again.

View 3 Replies View Related

Ubuntu Networking :: Added Some Loopback Ip's And Strange Behaviour Ensues?

Feb 7, 2010

I added the following lines to my /etc/rc.local file:

Code:
ifconfig lo:0 10.10.10.1 netmask 255.255.255.0
ifconfig lo:1 10.10.10.2 netmask 255.255.255.0

[code]....

View 5 Replies View Related

OpenSUSE Hardware :: Synaptic Touchpad In 11.3 - Strange Behaviour With Dragging And Middle Click

Jul 19, 2010

One strange and little annoying issue I notice with my openSUSE 11.3 installation is my Synaptic touchpad behaves way too strange.... Dragging a window or icon - half way around - a click is generated (probably a middle click I guess) and I need to re-drag it again.... In the browser when I try to select a text - again by dragging - a middle click gets generated... The same happens when I use gvim in visual mode too - I end up pasting the code I had selected halfway because of the middle click....

Middle click can be generated only if I press both left and right click buttons - which I'm pretty sure I'm not.... I tried playing around with the touchpad settings but no good.... I'm not able to find anything related to the middle click on the settings application... My touchpad works fine in Ubuntu and was in 11.2 as well.... Yes it works fine in Xp too.

View 9 Replies View Related

Software :: Strange Cent OS 5 Behaviour On Failed Software Raid Device?

Oct 26, 2010

I've got a simple software RAID1 configuration (2x250gb disks) running on Centos 5 where one of the devices appears to have failed.Whilst the system is continuing to run, the ext3 filesystem on the raid device has been placed into read-only mode Is this normal behaviour? As one of the devices is still operational I can't see why this should have happened. Can anyone explain what may have caused the OS to do this?Output from /proc/mdstat is:-

Code:
Personalities : [raid1]
md1 : active raid1 sdb2[2](F) sda2[0]

[code]....

View 1 Replies View Related

Programming :: Sed Bash Command - Not Print Backslash In Perl

Jul 11, 2010

This pretend to be a script for rename a lot of files automatically. So I put the list of files in an array named @lista. But, as you can see, at the end of the command I use a sed filter to print out a backslash for those files that have spaces in their names, so the path for those files could be rightly interpreted.

But there's no way I could print a backslash. It works well when I use the Perl's sed substitution s///, but I need every path in the array to be fixed.

I'd like to add that the bash command works perfectly well alone. I mean outside the Perl script.

This is de command line with the sed filter:

Code:

And this is what it brings:

Code:

View 12 Replies View Related

General :: Command Line - SSH To Server Without Including Username In URL On Unix/Mac

Sep 8, 2011

I am trying to ssh into my server from the command-line without including the username in the url. I do not want it to send any username, as it currently takes the active account and sends that as user.ex:

ssh server.com -> (doesn't send default username)

instead of [URL] I would want to input username directly into the server, just like it is done using putty on windows. he wants to be prompted for a username, rather than having to provide one when connecting - but I don't really see the utility in such a thing. - birryree Sep 8 at 17:41

View 3 Replies View Related

Programming :: Unpredictable Behaviour With Send/recv System Call?

Jul 30, 2011

I am making a library, but I am facing a strange problem while sending data over network using ethernet.

I am sending 39 bytes of the data from one server to slave application but some time slave receives 39 bytes and some time it receives 29 bytes. And when ever slave receives 29 bytes all the memories to which my pointers are pointing get changed. This problem is only when I am sending data from the server to slave, while sending data from slave to server I am facing no such issue.

View 10 Replies View Related

Programming :: C++: Not #including Files?

Jun 16, 2010

I'm trying to make my program as small as possible. Currently it's down to 17.8 KB, but I'd like to get it smaller (I know, I'm insane). Is there a way to not use the "#include" directive to include the entire header, but rather to just load only the stuff I need? For example, I just want to include 'sprintf' and 'printf' from stdio.h, not the entire header. Is this possible? Or am I misunderstanding some fundamental element here?

View 14 Replies View Related

Programming :: Sum The Numbers Between And Including A And B?

Feb 11, 2010

write a script in bash or shell to add the numbers between and including two numbers

View 3 Replies View Related

Programming :: Copy And Replacing Specific Line From File1 To File2 Line By Line

Mar 22, 2011

I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.

At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.

What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.

I tried to use paste command but I cant do for specified line alone.

Here i showed the data format in the file. I used the line number for clarity purpose.

Code:

View 10 Replies View Related

Ubuntu Installation :: Strange Line Of Text Appeared On Open Gedit Page On First Use After Upgrade From 10.04 T0 10.10

Jun 11, 2011

Strange line of text appeared on open gedit page on first use after upgrade from 10.04 t0 10.10. I was reading something and copypasting the odd bit onto a gedit note: left the room, returned to find blank page except for "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn". Then I saw that it was just the tail-end of a longer line which had stretched the page width to max, and by deleting backwards I arrived beneath my intact notes. The line was "I[my bolding]nnnnnnnnnn...nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnby v9898". I googled v9898. And there's a v9898. com. It provides something for Windows systems.

View 1 Replies View Related

Programming :: Including Headers Recursively - Is It Right?

Jul 29, 2010

Say, I have a header file containing all required includes:
Code: /* global.h */
#include <stdio.h>
#include <unistd.h>
...
#include <dirent.h>
#include <signal.h>
... /* and so on */

I have several modules in a program (*.h *.c files) and in each *.h I include global.h, then they are included in corresponding *.c files. And I receive strange messages from compiler, like a "warning: implicit declaration of function fdopendir", "error: expected declaration specifiers or '...' before 'siginfo_t' ", "error: 'DT_DIR' undeclared..." though these types, functions and constants are all declared in system headers. What does it mean?... Compiler is GCC 4.4.4-2, system is Fedora 13 x86_64

View 9 Replies View Related

Programming :: Including A Space Taken From String In A Var?

Jul 26, 2011

I have a tsv file that I'm trying to break down, line by line, then column by column so to speak. The file is a list of exported usernames, passwords, and display names from an email server, I need each separate to be used in other commands to provision the new server. My problem is, each display name contains a space, as usual with people's names. Here is the script for reference:

Code:

while read line
do
uname=`echo $line | awk '{ print $1 }' >> works`
pass=`echo $line | awk '{ print $2 }' >> works`

[code]....

View 14 Replies View Related

Programming :: Access A File Line By Line, And Check The Length Of Each Line.

Feb 13, 2011

I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?

View 1 Replies View Related

Programming :: Compare Two Filenames Including The Paths?

Jun 22, 2011

I am trying to compare two filenames including the paths. Basically if two paths are similar then my program wants to display message. So I need to check for if two pathnames are same in the sorce and destination. So I was trying for the code to compare tow filename sincluding "" and if the Parent FIle Path is found in the child file path then I need to displays ome message. I was trying to modify something like this:

#!/bin/ksh
# Sample script
file1="C:TextLatestArticleNews.txt"

[code]....

View 7 Replies View Related

Programming :: Compiling A C++ Program Including Libpq-fe.h Using Cygwin

Sep 16, 2010

Compiling a C++ program including libpq-fe.h by the command Code: g++ -I/usr/include -L/lib -lpq my_program.cpp for access to a PostgreSQL database results in the error Code: undefined reference to '_PQconnectdb'

View 4 Replies View Related

Programming :: Including User Defined Header File?

Apr 29, 2011

i got a sample.c which generate a linked list for sorting according to the number generated. then i want to split the sorting function into a header file. and it looks like the sort function in the header file could not access the linked list in the main. the error is dereferencing pointer to incomplete type

sample.c

Code:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

[code]...

View 2 Replies View Related

Programming :: Compare Two Files Line By Line And Print The Line Which Is Same?

May 30, 2011

I am trying to write a program in C which compares two files and prints the line that is equal.

Here file1.txt has

and file2.txt has

Note: file2.txt consist of only a single string where as file2.txt has multiple lines. Actually im comparing two files with md5sum values.

Here is the code but it compares only first line of files..but it should compare the whole file1..and sorry iam a beginner in C can any1 sujest some modification to this code so that..it can compare file2 with entire file1

Quote:

View 9 Replies View Related

Programming :: Insert Line Using Sed Or Awk At Line Using Line Number As Variable

Jul 25, 2011

I want to insert a line at a particular line number using sed or awk. where line number is not fixed and is in form of variable.

I want to use variable in sed or awk command.I tried something like below, but no luck.

View 7 Replies View Related

Programming :: Create File Listing In C++ That Will Generate Line Number On Every Line Of Code

Apr 11, 2010

I have a project due for my Intro to C++ class and we are suppose to generate a file listing that will take an input of a C++ source code with .cpp extension and make a copy of it with a .lst extention that will have a line number preceding each and every line.

View 12 Replies View Related

Programming :: Set Indent In .emacs To Enable New Line Starts From The Same Position Of Previous Line?

Dec 29, 2010

How can I set indent in .emacs to enable my new line starts from the same position of previous line?

like this;

Hello world <enter>
Second Hello world // "S" starts right under first line's "H"

View 4 Replies View Related

Programming :: Adding Line From File1 Into A Line Of Another File Based On Maching IDs

Jan 3, 2011

I wish to add information to one of my files based on matching IDs,

Here is an example

(the id is the 3 colunm)

(the ID is the 2 colunm)

And the output i wish to be

OUTPUT:

So as you can see the ones that do not match are still present, and the ones that do match just have the extra information from file2.txt added to them.

I thought about using join but that only seems to join the ones that match displays thoes only. i would like all the information in the output file.

View 6 Replies View Related

Programming :: BASH: Each Line Of Multiple Text Files Gets Added To One Line?

Sep 12, 2010

I currently have 3 files with floating point data that I wish to have in a single file with the format:

Code:

F1 F1 F3 Output
a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3
a4 b4 c4 a4 b4 c4

View 3 Replies View Related

Programming :: Perl Script To Replace Line After Finding Previous Line

Feb 28, 2011

At the moment I have a flat file which is being used by a few people. I want a script to remotely change the file, so I can start logging who is doing what.At this point here is one requirement I am trying to develop. We have text blocks who pretty much look like.I hope this is somewhat clear. I try to find $param for the right $workflow and change that. Can you help me to find $$var3 and change that?

View 1 Replies View Related

Programming :: Programing - Reading File Line By Line Then Char By Char In Each Line

May 29, 2010

I've never programed shell scripting.

Code goes like so:

I simply want to read a file "data.txt" line by line Then char by char and add them into a result var. The file is supossed to always contain numeric values

View 8 Replies View Related

Programming :: Open Two Text Files - Read Them Line By Line And Update Parameters Of The 3rd File ?

Oct 18, 2010

I have two txt files containing x and y coordinates: xcoord.txt & ycoord.txt. I need to open them; read them line by line to get each coordinate; then each time I need to update Xs and Ys parameters inside another file called "dc.in" with the grabbed values.

Finally each time I need to run two exe files ( dc_2002 and st_vac) and produce corresponding output for each Xs and Ys ( dc.in is an input file for this exe files)

I have written the following code but it does not work:

View 14 Replies View Related

Programming :: Perl - Delete Line From Text File With Duplicate Match At Beginning Of Line

Apr 1, 2009

Was wondering if any perl guru's could help me with a quick log file adjustment. I have a text file that looks like so (tabs and newlines are revealed so you can see what separates the data):

There are maybe 100 lines of text in this file at any given time. I need to delete all duplicate lines only looking at the first bit of text prior to the first tab. It doesn't matter which one gets deleted as long as there are no two lines that begin with that same text at the beginning before the first tab. So in this example, either the fist line "1234" or the last line "1234" would need to be deleted. I already have code in my script that opens the files - I just need the code to read the text into an array and the part that would find matches based on the above criteria, and make the deletions.

If it would be easier, I can even do a system call and use SED (v4.1.5) and/or AWK (3.1.5) instead.

View 7 Replies View Related







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