Sponsored Content
Top Forums Shell Programming and Scripting replace line starting with not a number Post 302641381 by Gery on Wednesday 16th of May 2012 05:26:41 AM
Old 05-16-2012
replace line starting with not a number

Dear users,

I have a file like this:
Code:
geometry,geometry_vertex_count,Id,strnum,platecode,datatype,dtnum,refnum,appearance,disappeara,color,geogdesc,datatype_ft_style,import_notes
"<LineString><coordinates>-130.6539,51.5103,0
-130.7708,51.6287,0
-130.8356,51.6832,0
-130.9211,51.7772,0
-130.9982,51.8414,0
-130.4732,51.3662,0
-130.5872,51.4701,0
-130.6539,51.5103,0</coordinates></LineString>",49,,413,101,TR,1,9829,10.000000,-999.000000,1,TRENCH
BET
JUAN
DE
FUCA
&
N.
AMERICA,0,
"<LineString><coordinates>-106.4797,21.2508,0
-106.4726,21.1354,0
-106.4749,21.0526,0

and I want this:
Code:
>>
>>
-130.7708,51.6287,0
-130.8356,51.6832,0
-130.9211,51.7772,0
-130.9982,51.8414,0
-130.4732,51.3662,0
-130.5872,51.4701,0
-130.6539,51.5103,0</coordinates>
>>
>>
>>
>>
>>
>>
>>
>>
>>
-106.4726,21.1354,0
-106.4749,21.0526,0

Basically, I need to replace all lines that start with a letter or string, except the "-" (i.e. negative number must remain like that).

I tried:
Code:
sed 's/[aA-zZ]/>>/g' file

but doesn't replace the " or ( or other symbols, how could I replace symbols in general? is there a way or should I specify all the symbols?

Thanks in advance,
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell script to replace a line contain an unkown pattern starting with "aaa, bbb"

Hello, can any one help me on this? I have a /etc/exports file, it may contain a line (I can not remember exactly). Let me use an a sample file myfile.txt which contains a line * mypattern uncertain key words I want this line (with any possible combination of the uncertain key words to be... (2 Replies)
Discussion started by: Dingrong
2 Replies

2. Shell Programming and Scripting

SED: Place char at starting and replace selected line

Hello Experts, I am working on a small file editing script. Since all experts here are very generous to give me the complete code, I would take up the problem in steps so that I ensure my opportunity to learn. AIM: The script has some commented and some uncommented lines. I need to : ... (2 Replies)
Discussion started by: hkansal
2 Replies

3. Shell Programming and Scripting

replace blank line number

hlow all i need help how can i replace blank number with awk input.txt 300::|355264313178490 301::|358814003239510 302::|358316038113400 303::|357954002633660 304::|354072040694090 305::|356956015214190 306::|352943020525180 307::|359574033836610 308::|381810990023580 so will be like... (4 Replies)
Discussion started by: zvtral
4 Replies

4. Shell Programming and Scripting

Replace first number of each line in a file with another number

Hi, I have a set of files in a directory that I have to read and replace the first occurrence of a number with another dummy number. This is what I have so far but it does not seem to work. The files have lot of other data in each row and each data element is separated by ,@, for file in... (13 Replies)
Discussion started by: scorpioraghu
13 Replies

5. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

6. Shell Programming and Scripting

Dynamic number to replace with line

Hi, I have file as below COMMIT # at 34572 # at 23432 COMMIT # at 5674 # at 7856 I want to replace with as below (12 Replies)
Discussion started by: kaushik02018
12 Replies

7. Shell Programming and Scripting

Replace a field with line number in file

I am working on a script to convert bank data to a csv file. I have the format done - columns etc. The final piece of the puzzle is to change the second field (after the R) of every line to reflect its' line number in the file. I am stumped. I can use awk on each line but need help looping through... (9 Replies)
Discussion started by: Melah Gindi
9 Replies

8. Shell Programming and Scripting

Find and replace in starting of line using sed

Hi, My requirement is, to find the word "data" and replace the starting of each line with # using sed. /dev/datavg/xxx /xxx ext3 defaults 1 2 /dev/datavg/yyy /yyy ext3 defaults 1 2 result to be #/dev/datavg/xxx /xxx ... (1 Reply)
Discussion started by: ksgnathan
1 Replies

9. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

10. Shell Programming and Scripting

How to read a file starting at certain line number?

I am new to ksh scripts. I would like to be able to read a file line by line from a certain line number. I have a specific line number saved in a variable, say $lineNumber. How can I start reading the file from the line number saved in $lineNumber? Thanks! (4 Replies)
Discussion started by: dcowboys13
4 Replies
DHCPDUMP(8)						     User Contributed Software						       DHCPDUMP(8)

NAME
dhcpdump - DHCP packet dumper SYNOPSIS
dhcpdump [-h regular-expression] -i interface DESCRIPTION
This command parses the output of tcpdump to display the dhcp-packets for easier checking and debugging. USAGE
dhcpdump -i /dev/fxp0 If you want to filter a specific Client Hardware Address (CHADDR), then you can specifiy it as a regular expressions: dhcpdump -i /dev/fxp0 -h ^00:c0:4f This will display only the packets with Client Hardware Addresses which start with 00:c0:4f. OUTPUT
TIME: 15:45:02.084272 IP: 0.0.0.0.68 (0:c0:4f:82:ac:7f) > 255.255.255.255.67 (ff:ff:ff:ff:ff:ff) OP: 1 (BOOTPREQUEST) HTYPE: 1 (Ethernet) HLEN: 6 HOPS: 0 XID: 28f61b03 SECS: 0 FLAGS: 0 CIADDR: 0.0.0.0 YIADDR: 0.0.0.0 SIADDR: 0.0.0.0 GIADDR: 0.0.0.0 CHADDR: 00:c0:4f:82:ac:7f:00:00:00:00:00:00:00:00:00:00 SNAME: . FNAME: . OPTION: 53 ( 1) DHCP message type 3 (DHCPREQUEST) OPTION: 54 ( 4) Server identifier 130.139.64.101 OPTION: 50 ( 4) Request IP address 130.139.64.143 OPTION: 55 ( 7) Parameter Request List 1 (Subnet mask) 3 (Routers) 58 (T1) 59 (T2) At the option field, the first field is the value of the option, the second one (between brackets) is the length of the option-datafield, the third field is the name of the option, the fourth field is the data of the option. RETURN VALUES
Always 0. NOTES
Privileged access is often needed for accessing the interface. BUGS
Not all the parameter options are printed verbose, because of lack of documentation. Not all the options are tested, because of lack of clients/servers with these options. If you have a dump of one of them, please send them to me and I'll incorperate them. THANKS TO
Ralph Droms and Ted Lemons "The DHCP Handbook", ISBN 1-57870-137-6. Peter Apian-Bennewitz <apian@ise.fhg.de> for his Client Hardware Address filtering AUTHOR
Edwin Groothuis, edwin@mavetju.org (http://www.mavetju.org) SEE ALSO
dhcpd(8), tcpdump(1), RFC2132 perl v5.10.0 23 June 2008 DHCPDUMP(8)
All times are GMT -4. The time now is 06:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy