General :: How To Put Some Characters On The End Of A Line

Nov 1, 2010

We have a list of cyclones in the world. Now i got to check whether or not the second field is more than 1000 mm. If so, than the line has to have a[*] at the end of the line. For exemple:

Australia:1411:55.55:Mackay Cyclone 1918:1918:Mackay
to
Australia:1411:55.55:Mackay Cyclone 1918:1918:Mackay[*]

I also have to use a substitute. So far i've got this but it fails, 6,$s/([0-9])111:1/.* [*]

View 7 Replies


ADVERTISEMENT

General :: Sort By Line Size (number Of Characters In A Line)?

Jan 8, 2010

I want to sort a number of lines based on their size:

data:
-------
12345678
87654321
1234

[code]....

Should output as:
-----------------
1
2
12
21

[code]....

But i'm gettings this with sort
----------------
1
12
123
1234

[code]....

Can we sort the above "data" text, based on "number of characters" instead of "character order"?

View 8 Replies View Related

General :: Moving Characters To The End Of Line (EOL) With SED?

Sep 13, 2010

Any time the word The appears at the beginning of a line, I want to move it to the end of the line and capitalize the new first word in the line. For example, The heaven becomes Heaven the. I'm trying to test this out for my Library.

View 2 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 :: PuTTY And 256-color - Line Drawing Characters ?

May 3, 2011

I'm having trouble setting up PuTTY with Ubuntu. I'm trying to get line characters to work in aptitude as well as 256-color support, but can only get one or the other.

Ubuntu Config:

Using 64-bit Ubuntu
Terminal type xterm-256color or putty-256color gives 256-color, but incorrect line characters.
Terminal type linux gives proper lines in aptitude, but only 16 colors.

PuTTY Config:

Using font with Unicode characters. (DejaVu Sans Mono)
Received Data is assumed to be in UTF-8.
Set to use Unicode line drawing code points.

Output from locale:

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 :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 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 :: Bash Script To Parse A File To Get A Set Of Line Between A Specific Characters?

Dec 23, 2010

I have a log file that contains information like this:

----------------------------
r11141 | prasath-palani | 2010-12-23 16:21:24 +0530 (Thu, 23 Dec 2010) | 1 line
Changed paths:
M /projects/
M /projects/

[code]....

what i need is, i need to copy the data given between the "---" to seperate files, for, e.g. the first set of data between the "---" should be in one file and another set of data in another file.

View 5 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

Programming :: Using Sed To Remove All But The Last 17 Characters On A Line?

Jun 3, 2010

I'm having a bit of a headbanger trying to work this one out. I'm trying to remove all of the characters on a line apart from the last 17. For example, I need to change this:

Code:

00000000000000000089;0bbfaeb8
01000000000000000089;0bcb5948
00000000000000000089;0bcc4c40

[code]....

View 5 Replies View Related

Programming :: Replacing Set Of Characters In A Specific Line Using Sed Or Awk?

Dec 29, 2010

I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.

<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />

[code]....

View 14 Replies View Related

OpenSUSE :: Change The Number Of Characters Per Line For Konsole?

Dec 21, 2010

Probably an easy question but my googlefu is weak. How do I change the number of characters per line for konsole?

View 6 Replies View Related

Software :: Filter Printed Line To Get Characters Between 2 Expressions?

Jan 28, 2011

I'm having trouble getting a sed command to work. I need to filter a printed line to get characters between 2 expressions. "<job>" and "<url>".

Code:
echo "<job>TEST<url>http://www.project.com/?code=001" | sed 's/^[<job>]*//' | sed 's/[<url>]*$//'
Produces:
Code:
TEST<url>http://www.project.com/?code=001

It takes off the first part but why is that not deleting the "<url>" and all the parts after that?

View 9 Replies View Related

Software :: Some Line Drawing Characters And Other Symbols Appear As Diamonds In Terminals (ttys)?

Sep 26, 2010

On my terminal only system ( no Xorg or guis ) I have a font rendering issue. In place of some symbols ( eg double-lines and some other miscellaneous line-drawing shapes) are generic diamonds. Attached is a fbgrab ( png format ) of elinks showing the problem. I have now configured elinks to only use single lines drawing characters ( which work fine ) for now as a work around. Here is my /etc/default/console-setup

Code:

# Change to "yes" and setupcon will explain what is being doing
VERBOSE_OUTPUT="no"
# Setup these consoles. Most people do not need to change this.
ACTIVE_CONSOLES="/dev/tty[1-6]"

[code]....

The numbers in the FONTFACE show the size of the font matrix. For example Lat2-Terminus20x10.psf is a font for codeset Lat2 with size of the font matrix 10x20 (i.e. 10 columns and 20 rows). If the number of columns is 8 then only the number of rows is specified. For example the font matrix of Armenian-Fixed15.psf has size 8x15.

In text video mode or if you use the RadeonFB kernel module only fonts whose font matrix has 8 columns can be used (that is the size should be a simple NUMBER rather than a NUMBERxNUMBER combination). The other fonts can be used only with framebuffer video modes and with the package 'kbd'. The console package 'console-tools' can not be used
with such fonts.

THE TERMINUS FONT:

The aim of the Terminus font is to reduce the eyes-fatigue when one has to read a lot. Currently this font supports only the Latin, the Cyrillic and the Greek scripts (the Lat15, Lat2, Lat7, CyrAsia, CyrKoi, CyrSlav, Greek, Uni2 and Uni3 codesets). The fonts with font face TerminusBold and size 14 or 16 are optimized for 8 pixels width glyph matrix (in most cases this means framebuffer). The fonts with font face TerminusBoldVGA and size 14 or 16 are optimized for 9 pixels width glyph matrix and can not be used with
framebuffer video modes.

The fonts with font face Terminus and size 14 or 16 can be used both with 8 and 9 pixels width glyph matrix. In the regular text video modes the width of the glyph matrix is 9
pixels. If you use the package svgatextmode then the width is 8 or 9 pixels and you probably know it. The Terminus font in this version of console-setup is version 4.26.

View 7 Replies View Related

Programming :: Change A Line In A File Code - Sed Special Characters Bash Script

Jan 26, 2011

I'm having issue when trying to change a line in a file

[Code]....

View 1 Replies View Related

Software :: Line-drawing Characters Not Longer Drawn In Console After Kernel Upgrade?

Jun 24, 2009

I upgraded in Ubuntu from 2.6.28-13 to 2.6.30 and now I get no line-drawing characters in applications like alsamixer; instead they are replaced by 127-bit chars like 'lqqk'. As a coder, I'd really like to understand what happened - what changed (file in /etc?) affecting terminal capabilities, and what does the kernel have to do with it .

PS: the distro is Jaunty and I used the debs at http://kernel.ubuntu.com/~kernel-mainline/:

Code:

linux-headers-2.6.30-020630_2.6.30-020630_all.deb
linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb
linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb

View 2 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 :: 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

General :: Create Cron Tab When DSL Line Down Set Automatically Restart The Network Service While DSL Line Up?

Oct 7, 2010

How to create cron tab when DSL line down set automatically restart the network service while DSL line up?

View 3 Replies View Related

General :: Getting The Line Of String From Previous Pipe Output By Line Number?

Feb 8, 2010

After running the following command, I get:

[root@yukiko /]# find / -iname .bashrc
/home/clamav/.bashrc
/home/vpopmail/.bashrc
/etc/skel/.bashrc
/root/.bashrc

But I would like to have a command that prints a specific line by supplying the command with the line number, for example:

[root@yukiko /]# find / -iname .bashrc | getline(2)
/home/vpopmail/.bashrc

Is there such a command on CentOS?

View 3 Replies View Related

General :: Script To Count # Of Chars Per Line - If Line Meets Certain Criteria - And Get Avg #?

Sep 11, 2009

I have several files with many lines something like this:

I'm trying to write a script that will count the number of characters per line that doesn't contain a ">" symbol and give me an average of those values. I have most of the script together but I can't figure out how to connect some of the steps.

Code:

View 3 Replies View Related

General :: Scripting - Feed An Input File Into An If Statement Line-by-line

Dec 23, 2009

I am trying to write a script that takes an input file ($FileName) and an intermediate file ($FileName.info) and removes lines from $FileName if the value in $2 of $FileName.info is <75.

I can't figure out how to feed only one line of the .info file to the if statement at a time so that it will perceive it as an integer instead of a list.

The error I am getting now is ./script.sh: line 6: [: : integer expression expected

Sample input $FileName

Code:

Code:

Code:

Script so far:

Code:

View 10 Replies View Related

General :: Parse A File And Print Each Line That Ends With Matching Pattern (if The Next Line Is Blank)

Aug 2, 2010

I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.

Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....

View 4 Replies View Related

General :: Command Line Way To View A Line Of A File With Context?

Feb 24, 2011

I'd like show a certain line or lines of a file with context, kind of like a unified diff, on the command line in Linux:

$ (something) -l 154 stuff.py
150: def foo(bar):
151: """

[code]....

View 5 Replies View Related

General :: Printing Command Line History Without Line Numbers?

Aug 22, 2011

How can I print Linux command line history without including the line numbers? I want to send it all to a text file like this:history >> history.txt

View 1 Replies View Related

General :: Appending To The Current Line In A File Instead Of Creating A New Line?

Apr 1, 2011

I am combining data from a couple different input files and creating an output file in a specific format. I notice that if I use the >> operator, information gets appended to a new line in my output file. This is useful, but if I'd like to append onto the CURRENT line, is there an easy way to do this? I've been googling around and see lots of complicated answers, nothing that suggests to me an easy way to do this. For example, if my output file looks like this:

b1a:] cat test
hello my name is
b1a:]

and I'd simply like to append "Bob", how can I do it? If I use

b1a:] echo Bob >> test
b1a:] cat test
b1a:] hello my name is
Bob
b1a:]

So what I would prefer is some command that would create the result:

hello my name is Bob

View 14 Replies View Related

General :: Match And Combine 2 Text Files Line By Line

Mar 21, 2011

This solution works but is slow with large files. I am looking for a faster solution.

The 2 files contain filenames, one of them has associated data I want to append to the other file's matching filenames

file1:

file2:

I append file2 by matching the unique_filenames and appending them with the tag data and some formatting

appended file2:


Here is the SLOW code

while read inputline.

View 9 Replies View Related

General :: Sed To Display The Pattern String - The Line Above It And The First Line Of That Para

Mar 30, 2011

I need to grep for a particular string and if found need to display the line containing that string, the line above that and also the first line of that paragraph.

Can this be done via sed.

Eg, My Paragraphs

OA connectA

Enclosure:

Interconnect Module #6 Status:

Here, if I grep for Critical, it should display the following

Similarly if I grep for Degraded, it should display

View 3 Replies View Related







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