General :: Sed Error - Extra Characters After Command

Aug 3, 2011

sed '/
$/ {N s/
//}'
sed: -e expression #1, char 10: extra characters after command

I want to understand what is wrong with my command line. When I can do the some of following in a script but not in a command line. I have been working through the tutorial at [URL]. When I got stuck at the section Working with Multiple Lines. These script works fine.

#!/bin/sh
sed '
# look for a "#" at the end of the line
/#$/ {
# Found one - now read in the next line
N
# delete the "#" and the new line character,
s/#
//
}' file

In my case I am looking for or return ^M.
#!/bin/sh
sed '
# look for a "#" at the end of the line
/
$/ {
# Found one - now read in the next line
N
# delete the "#" and the new line character,
s/
//
}' file

The problem is when I try to convert it to a single line shell command it gives me an errors.
sed '/
$/ {N s/
//}'
sed: -e expression #1, char 10: extra characters after command
sed '/
$/{N s/
//}'
sed: -e expression #1, char 9: extra characters after command
sed '/
$/{Ns/
//}'
sed: -e expression #1, char 8: extra characters after command

I want to understand what is wrong with my command line. When I can do the following in a script but not in a command line. I have created a sed script to do the work I want.
cat test.sed
#!/bin/sed -f
/
$/ {
N
s/
//
}

View 1 Replies


ADVERTISEMENT

General :: Remove Extra Characters From Multiple Files

Sep 18, 2011

I have a directory (Linux user) with a number of files which contain an added [!] to the end of each file name so that each file reads out as:
foo something [!].zip
bar something [!].zip
helloworld [!].zip
etc.
What is the quickest way to batch rename these to remove the ending [!] character combination from these file names?

View 2 Replies View Related

Ubuntu :: Mass Renaming Files - Get Rid Of Two Extra Characters On The End

Feb 12, 2010

I have a folder with various subfolders of files. These files all have two extra characters on the end that I want to get rid of. How would I go about telling the terminal to go into X directory and every subdirectory of X directory, look for all files with the extra characters, remove them, and keep everything else the same?

View 3 Replies View Related

General :: Set Up New Keybinding For Finding Last Command Executed Using The First Few Characters Of The Command In Csh?

Jul 21, 2010

I want to be able to use Ctrl+R to have reverse-i search. Also if I press Shift+Up Arrow after typing the first few characters of a recently executed command then the shell should complete the command by finding the most recent commmand having the same first few characters.

View 1 Replies View Related

General :: Scp Command And Internaltion Characters

Feb 20, 2010

When I upload a file usind the scp that contains the German characters these characters get changed to . For example, a sentence in an html file like this

looks like this

Why are this characters getting changed?

View 6 Replies View Related

General :: Ps Command Is Visible In 80 Characters?

Sep 1, 2010

When i am running ps -ef command I am getting the execution of the commnad in "80characters"

View 5 Replies View Related

General :: Escape Characters In Watch Command

Oct 20, 2009

Need little advice running this command.
watch -d 'ps aux | awk '{print $4" "$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr | head'

I get this error message from AWK. awk: cmd. line:1:
{print awk: cmd. line:1: ^ unexpected newline or end of string

I have tried all the usual by trying to escape the single and double quotes in the command but same result. The end result should be the a listing of memory hungry processes that are scanned every 2 seconds (watch default value).

View 2 Replies View Related

General :: Command To Count All Characters In File

Mar 26, 2010

Anybody know and command to count any characters in file? I would like to know the total number of character " (quote) in file. My idea is to check if in a script the total number of this character is pair.

View 4 Replies View Related

General :: How To Strip/trim Characters In Command Line

Mar 23, 2011

I have a bunch of files (around 900) that have some special characters. Some of the files contains example, and quoting "[useless] filename (something)"so what I want is just to strip the brackets and parenthesis, some are folders, others are text files

View 1 Replies View Related

General :: Playing With Various Characters In The Command- Line Interface?

Apr 23, 2010

I am playing with various characters in the command- line interface trying to learn what they mean and when i should use them.

View 7 Replies View Related

General :: Bash : Pass Command Line Arguments Containing Special Characters?

Jul 14, 2010

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program(there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]".Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.?

(Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 7 Replies View Related

General :: Bash: How To Pass Command Line Arguments Containing Special Characters

Jun 24, 2011

I've written myself a linux program "program" that does something with a regular expression. I want to call the program in the bash shell and pass that regular expression as a command line argument to the program (there are also other command line arguments). A typical regular expression looks like "[abc]_[x|y]". Unfortunately the characters [, ], and | are special characters in bash. Thus, calling "program [abc]_[x|y] anotheragument" doesn't work. Is there a way to pass the expression by using some sort of escape characters or quotation marks etc.? (Calling program "[abc]_[x|y] anotheragument" isn't working either, because it interprets the two arguments as one.)

View 8 Replies View Related

General :: Error - BAD PASSWORD: It Does Not Contain Enough DIFFERENT Characters

Oct 29, 2010

I'm trying to change the password for an account using the passwd command in Linux. However I'm getting the error:

"BAD PASSWORD: it does not contain enough DIFFERENT characters"

Even though the passwords I'm trying seem pretty safe and complicated enough to me. I googled and think this is controlled by something called cracklib? Don't know for sure though. How can I change the settings for this, perhaps lowering the amount of different characters required, or disabling whatever security setting is causing this error?

View 4 Replies View Related

General :: Does Non-printing Characters Escape Characters Still Needed For PS1 Definition?

Aug 28, 2011

While modifying the definition of my PS1, I saw that "[" and "]" markers should be added to help bash to compute the right display lenght. Many exemples on the web do not use them or even mention them.I searched for a solution to add them automatically, like with sed, but I didn't find any example.Are they still needed and is there a recommandation not to use sed to define PS1?

View 1 Replies View Related

Ubuntu :: Command Ls And Joker Characters

Nov 11, 2010

I need to find files that contains do in their name, it can be anywhere in the word, exsamples downloads, loldo, asdomk... ?

View 1 Replies View Related

OpenSUSE :: What Exactly Is The Extra Repository /repositories/KDE:/Extra

Jul 18, 2010

there are 2 related to 11.3: openSUSE_11.3/ and openSUSE_11.3_KDE_Distro_Factory/ Index of /repositories/KDE:/Extra they are not listed as official kde4 repos here KDE repositories - openSUSE, but they are in the same directory structure on the build service so it would assume they are official (what ever official means) They have rpm's I didn't see in community and playground (at least for 11.3) such as audex and clementine I would guess that they are for the stable and factory versions of KDE4 but then shouldn't there be a 3rd for unstable if this was the case? Or do they refer to the distro, 11.3 stable and 11.3 factory

View 6 Replies View Related

General :: Ubuntu 10.10 And Command Line Scripts - Error - Android: Command Not Found

Mar 26, 2011

I know my way around MS Windows much better, but I just don't feel right trying to program something for Android on a Microsoft operating system. I am interested in Android programming so I followed the instructions on [URL] to install the environment on my computer...

I just installed the JDK, SDK, Eclipse successfully (or I assume):

* When I get to Step 4 where I'm supposed to run 'android' it will not run. I get the error message "android: command not found" (I am definitely in the right directory).

** When I double-click it in nautilus, it opens up in gedit. I can set the permissions in nautilus (through the properties - Allow executing file as a program) and get it to work,

My system:

Intel i7
Ubuntu 10.10 Maverick Meerkat
android-sdk-linux-x86
eclipse 3.6.2

View 5 Replies View Related

Programming :: Omit Specified Characters From The Output Of A Command?

Nov 18, 2010

After typing "man cut" in my terminal I can't seem to find this answer.

I am trying to write several shell scripts and want to remove the 'lp:<package name>' from the beginning of each line of the output of "bzr ls" as well as any notices at the beginning of the output, leaving only file and folder paths.

View 6 Replies View Related

OpenSUSE Install :: GRUB Error 17 When Extra Hard Drive Not Attached

May 9, 2011

I recently installed openSUSE 11.4 on another hard disk of my 11.3 machine. I have another drive in my computer that is used solely for extra storage. Before installing 11.4 I could boot my computer with or without the drive installed, but now if I try to boot without it I get Error 17 from GRUB. I don't understand this as there is nothing on that drive that should be needed by boot and I can find nothing in the GRUB configuration that references the drive.I am getting ready to clear the whole system for a fresh install anyways, but it would be nice to know for future knowledge what is causing it.

View 9 Replies View Related

Ubuntu :: Delete All ASCII Characters In File - Leave Chinese Characters Only

Jul 8, 2011

What command could I use in terminal to delete all ASCII characters? That is, delete a-z, A-Z, 0-9, and all punctuation? I have a file containing Chinese characters, and I want to remove everything else and leave just the Chinese.

I can use grep to leave only the lines that have Chinese in them, but this still leaves a lot of non-Chinese stuff on those lines. Does anyone know how I could actually remove everything that isn't Chinese?

View 4 Replies View Related

OpenSUSE :: Error After Upgrading - OS Does Not Recognize Many Characters At Many Places

Aug 3, 2011

I upgraded my openSUSE 11.2 to openSUSE 11.4 . Unfortunately after the upgrade the OS does not recognize many characters at many places . For eg :- In YaST , everything is square boxes as if the character set weren't present . Moreover , every theme has same font at every place i.e. Sans Serif . After the upgrade, the graphics have become worse . I'm using KDE environment . Hardware is : Core i5/4GB .

View 1 Replies View Related

General :: Using One Command "make UImage" Getting Error 127 Command Not Found?

Feb 23, 2010

I am doing some embeded linux work in ARM 9263.So I need to make a image for that board.But when I using one command "make uImage" I am getting the following error.

make: arm-linux-gcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
HOSTCC scripts/basic/fixdep
code....

View 4 Replies View Related

OpenSUSE :: UTF-8 Characters On Vi / Can't Handle Those Characters Properly

Jun 16, 2010

I have my OpenSuse 11.1 box set up with utf-8, however, every time I try to open a file with utf-8 characters with vi it can't handle those characters properly.

View 6 Replies View Related

Ubuntu :: Error: Dependency Is Not Satisfiable: Libavutil49 (>= 3:0.svn20090303-1)|libavutil-extra-49 (>= 3:0.svn20090303-1)"?

Jan 17, 2011

have an error when I try downloading the Game Engine Panada3D in Gdebi Packaged Installer! There error is" Error: Dependency is not satisfiable: libavutil49 (>= 3:0.svn20090303-1)|libavutil-extra-49 (>= 3:0.svn20090303-1)"

View 1 Replies View Related

General :: Control-Up,Down,Left,Right As Extra Keys?

Feb 18, 2010

Is there any way of getting the arrow keys to act differently while the control key is pressed. On my system ^-Up and Up generate the same code...

View 3 Replies View Related

General :: Use Gparted To Extra Space To /dev/sda5/

Jul 12, 2010

I want to use Gparted to extra space to /dev/sda5/. Using a live CD I shrunk /dev/sda7 and I have 9.77 Gb of free space.

However I can not increase the size of /dev/sda5 - I can only shrink it.

Do I need to reboot and then try?

View 7 Replies View Related

General :: Which Package Do The Extra Applets In Gnome?

Jun 4, 2010

I have a problem, I'm making my own Distro (I hope it'll be cool :P) and I have some problems,

1. What should I still install? What packages should be in? (for normal use)
2. What should I do to make system automatically find sound when start?
3. Which application/command starts a window, where is logout button, turn off etc. in Gnome?
4. Which package do the extra applets in Gnome?

View 2 Replies View Related

General :: Ubuntu : Delete The Extra Spaces?

Jul 28, 2010

I want to ask a question regarding the terminal in ubuntu. When i deleted some lines in the config files for example, there will be those so-called extra spaces left after deleting and i can't seem to delete those spaces and 'pull' up the lines below. So, how to delete those extra spaces?

View 13 Replies View Related

General :: Command To Get Past An I/O Error In A File?

Sep 24, 2010

I have a log file that has an I/O Error about halfway in. It is a syslog file with Sendmail log entries. I need to break into smaller files. I tried using a simple egrep command creating new files by the date _egrep "^Sep 19" filename_ but the command hangs when it hits the I/O Error.

I tried split but it bails out when it hits the I/O Error. Is there anyway to read the file and get past the I/O Error? IS there a way to read the file from the bottom up so I can get the data from the top and bottom?

View 4 Replies View Related

General :: Error When Issuing Mkdir Command

Sep 8, 2010

I just rebuilt my system from cd CentOS5.5

Went to make a dir and got this...

The command took a while to come back. I googled it but nothing came back.

Could this be hadw error? The drive is new. I was able to issue the command again and have it work.

View 2 Replies View Related







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