General :: Remove Lines With Variable Value?

Jul 20, 2011

I have model output data in ascii format. It contains thousands of lines. The output file contains multiple text lines with variable values. here I copy-paste some of it's contents.

Code:

73438 170 23:53:20 3.481328E-03 1.824611E+04 1.824612E+04 1.333962E+16
73439 170 23:56:40 3.481210E-03 1.824611E+04 1.824612E+04 1.333962E+16
73440 171 00:00:00 3.481093E-03 1.824611E+04 1.824612E+04 1.333962E+16

[code]....

i want to remove the lines starting by WRT and DEF.

View 7 Replies


ADVERTISEMENT

General :: Count The Number Of Lines Inside A File And Put The Output Into A Variable?

Feb 1, 2011

i need to count the number of files and put the output into a variable. i used wc -l filename but i couldnt find an option to put the output to variable. example if the number o line is 5, i need the output of echo $x is 5.

View 3 Replies View Related

General :: Create A Single Line Of Output From Multiple Variable Lines Of Input

Feb 3, 2010

I need to create a single line of output from multiple and variable lines of input in a Linux bash shell script.

My input file looks like this:

Where there may be any number of umsecondaryphonenumber lines; if there is not a umsecondaryphonenumber line for a telephonenumber, I don't want to write any output.

So, the output file should look like:

The script I have so far is:

My question is - how do print each of the elements of an array in one record - i.e. what do I put in place of howdoiprintarray?

View 2 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related

General :: Need To Remove Lines With Sed

Mar 14, 2011

I have a large file and need to remove all the lines containing symbol/symbols.

For example: . , ! " # $ % & / ( ) = ? � � ' � + * � { } ] [ - _ : ; , > < (maybe more)

View 13 Replies View Related

General :: SED Or AWK - Remove Every 4 Of 5 New Lines

Aug 30, 2010

I have a file that looks like this:

1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
1
2 3 4 5 6 7 8 9
10 11 12 13 14 15
16 17 18 19 20 21
22 23 24
...
I would like to reformat it to look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
...
Is there a nifty awk/sed one-liner to do this operation?

View 6 Replies View Related

General :: How To Remove Over Written Lines

Apr 19, 2010

I need to filter the log from a massive wget. I want to remove the progress lines and only leave the last one. Now each progress line starts with a newline '

View 2 Replies View Related

General :: Using Sed To Remove Lines Around A Specified String?

Jun 4, 2010

I have a data set that takes the form...

0.0 43
12572.9102 80.8521 263.3575 0.0200 12.6358 -86.4942
4.3870e-06 -0.3547

[code]....

View 1 Replies View Related

General :: Remove X Lines From Output?

Oct 11, 2010

I would like to know how to remove X lines from output. i have a test file and i want the output without the first 2 lines

[root@node1 ~]# cat test
1
2
3

[code]....

View 5 Replies View Related

General :: Using Sed To Remove Lines With Duplicate ID's?

May 8, 2010

I have a file that contains lines representing the nodes of a polyline but I only need the first point in each segment. With the following text:

0,"013A",0.57,260739.891,4379258.87
0,"013A",0.57,260737.674,4379258.94
0,"013A",0.57,260684.628,4379258.35
1,"013A",0.545,260769.915,4379257.84
1,"013A",0.545,260739.891,4379258.87

[Code]....

The problem with uniq is that the last two colums will differ. I don't care about the x/y for any points following the first one.

View 4 Replies View Related

General :: Advance Sed To Remove Multiple Lines

May 12, 2010

I have a txt file with couple of comment lines:
Number of title = !num!
#line1
#line2
#line3

I wrote a script with "sed" to replace !num! in this file, which is very straightforward. However, based on the !num!, I want to remove the number of "#" based on the !num! value. Is there an easy way to do that with "sed"; otherwise, i will have to write a script to loop through the file.

View 8 Replies View Related

General :: Remove All Lines In A File Containing Sameword?

Aug 6, 2010

When i want to remove particular lines containing a specific word in from entire document at a time,i am using the following command.

awk '$columnno !~/specificword/' inputfile > outputfile

But here, coulmn no is my problem, because iam having this in different columns. So i need a solution for it.

How to write such removal command without mentioning column no. , ie irrespective of column no, it has to remove all lines having that specific word.

View 10 Replies View Related

General :: Remove A Certain Character From A Variable?

Jun 15, 2010

I want to remove single quote from a variable. eg: Suppose I have a variable VAR='TEST' (including single quotes) How can I remove single quotes and make it TEST.

View 5 Replies View Related

General :: Finding A Script To Remove Lines Without Chars?

Dec 26, 2010

I have a text file that each contains either a domain or an IP, like this:

Code:

[me@server ~]# cat file1
122.foo.com
yahoo.com
23345229.com

[code]....

I want to remove all IPs in that file and keep others, so the result be like:

Code:

[me@server ~]# cat file2
122.foo.com
yahoo.com
23345229.com

[code]....

View 6 Replies View Related

General :: Commands To Remove Particular Few Lines In History File?

Jun 16, 2010

Is there any commands or scripts to remove only selected line in the history file.

View 1 Replies View Related

General :: Remove Lone Lines From A Text File?

Jul 6, 2011

anyone has ideas how to remove lone lines from a text file?

If I have a file that is like this:
-----------------------------------
line 1

[code]...

View 14 Replies View Related

General :: Shortcut To Remove First Character Of Multiple Lines In Gedit

Jan 23, 2010

I want to be able to remove the first character of a line when I highlight multiple lines in gedit. Example:

%Example is
%Commented Code
%Uncomment using this shortcut

I would then highlight/select these lines, and remove the first character to make it look like this:

Example is
Commented Code
Uncomment using this shortcut

I'm pretty sure there is an actual shortcut for this. If there is another text editor on Linux that it would work in, it would be nice to know how to do it in that editor as well.

View 2 Replies View Related

General :: Remove Line Breaks From Lines Ending With A Comma?

Nov 10, 2010

I have a CSV file that's created in an application that can't output lines longer than 250 characters. the data fields, all together, are longer than this. how would I remove the line break from every line that ends with a comma? For example:

A,B,C
D,E,
F
G,H,I

becomes:

A,B,C
D,E,F
G,H,I

View 1 Replies View Related

General :: Remove Lines From A Syslog Text File That Have Duplicate Strings

Mar 17, 2011

Trying to remove lines from a syslog text file that have duplicate strings

Mar 10 06:51:11[http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360]

then a few lines down

Mar 10 06:52:03 [http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360

got the same thing in terms of a u: number but the issue is I need to remove duplicates and just leave one and the file has multiple duplicates of different u: numbers and it's 14,000 lines long. can anyone tell me if I can use awk? sed? or sort for something like this to? removing lines that have a certain string in there that's a duplicate.

View 4 Replies View Related

Programming :: Using Variable To Store Command Lines In A Pipeline?

Jan 28, 2010

Was trying to write a shell script that has if conditional statements to decide different arguments for a command.Basically:

Code:
if [ "$1" = 1 ]
then

[code]...

View 6 Replies View Related

Ubuntu Servers :: Bash Variable Multiple Lines - Store In $a?

Apr 30, 2010

I have this script:

Code:
a=awk'{print $8}' f1.txt

How can I make it store lines in $a ? In the way above it creates one big line.

View 2 Replies View Related

Programming :: Perl Script Get Environment Variable LINES= For Current Session?

Apr 1, 2009

Want to return current LINES=, tryng to avoid the "hacky" backticks and string manipulation way

ie: my $somevar = `set | grep LINES`

I tried using the env command and it returns a empty value?

my $lines = $ENV{'LINES'};

$= doesnt work well for putty sessions...

my $lines = $=;

View 6 Replies View Related

Programming :: Remove All Lines Containing 'A,,,,,,?

Nov 3, 2010

How can I remove all lines which contain A,,,,,, I tried the following sed statements but no luck.

Code:

sed "/A,,,,,,/d file"
sed "/A,,,,,,/d file"

View 6 Replies View Related

Ubuntu :: How To Remove These Lines In Nautilus

Aug 22, 2010

I'm using Ubuntu 10.04.1.How to remove these lines in Nautilus

View 7 Replies View Related

Programming :: Remove All Lines Containing Extended Characters

Nov 7, 2010

I am using 'sed -e /foo/d' to match lines which I want to delete from a file. I discovered I have some lines which contain random (extended?) characters like 'ủ' which I would also like to delete. The lines in the file should only contain alpha numeric characters.

View 8 Replies View Related

Programming :: Remove Extra New Lines (BASH)

Jul 15, 2010

I'm trying to search through some pdf files and I'm doing so by converting them to text files using pdftotext which is fine but I'm trying to get the number of occurrences in a paragraph of different words and it's adding a new line character at what it thinks is the right hand margin. I'm trying to remove all these singe new line characters but keep the doubles and I can't seem to work it out. i.e.

This is some text that has been broken.
Another paragraph.
becomes
This is some text that has been broken.
Another paragraph

View 9 Replies View Related

Programming :: Remove Specific Lines From File

Jan 21, 2011

I'm trying to come up with ideas for a simple way to strip a specific "entry" from a text file.I know tools like sed and perl can remove specific lines from a file but I haven't been able to come up with an elegant way to do my group of lines.In my file, the first "Location" line and the "SVNPath" line should be unique every time... but are they enough to strip out the whole set of the group plus the trailing one line of white space separating each group? Add to this, my file will grow as new entries are added (always appended to the end) but new entries will have the same formatting.

View 9 Replies View Related

Programming :: Bash Text To Variable Accessing Individual Text Lines?

May 2, 2010

i am on processing text tasks And i found that if you assign a text to a variable is chomp'ed automatically the newline

Code:

variable=$(cat file.txt)

The problem is i can only access the items/lines using:

Code:

for line in $variable
do
echo $line
# Other commands
done

how do i convert this to an indexed array. More importantly, how do i get access to individual $line[0], ..., $line[n] Another thing, if the file.txt, has lines with spaces it is a mess using the for...in..., but echoing prints line by line...o_0

View 11 Replies View Related

Programming :: Remove Characters From Within Variable

Feb 20, 2011

I am doing a mysql query with a bash shell script like:
mysql translator -u root --password=******** -e "SELECT word FROM tagalog ORDER BY RAND() LIMIT 1" | while read line; do
echo $line

So when I echo the value of $line I get:
word
magandang umaga
"word" is the name of the row in the table and maganda umaga is a randomly selected choice from the row. Is there a way i can remove the name of the row from the variable $line. With a result that will allow me to echo $line and output only the randomly selected entry in from the row e.g. magandang umaga

View 13 Replies View Related

Programming :: Remove The Last Character From Variable

Jun 22, 2010

i have the following:

Quote:

echo %host%|sed "$s/.$//"

this would remove the Last character of the value assigned to the %host%. for example if my value is: abcd i get abc. but i am not able to assign the output. for example when i do

Quote:

set k=`echo %host%|sed "$s/.$//"`

after doing echo %k i get no output at the command prompt...!! whereas when i just type:

Quote:

echo abcd|sed "$s/.$//"

at the command prompt i get abc. maybe some other ways to Remove the Last character...?

View 13 Replies View Related







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