removing occurances starting with [


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting removing occurances starting with [
# 8  
Old 04-03-2009
Hammer & Screwdriver A couple ways to prove this out

display without the cut command
Code:
> echo "$invalue" | sed "s/\[[0-9]/&:/g" | sed "s/[0-9]\]/:&/g" 
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/:0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/:0];

Or, I can convert that : to a new-line as this might make it easier to see why the 1,3,5 fields

Code:
> echo "$invalue" | sed "s/\[[0-9]/&:/g" | sed "s/[0-9]\]/:&/g" | tr ":" "\n"
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/
0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/
0];

# 9  
Old 04-03-2009
I used cut command and it worked .. I also undestand how it wokrs. Thanks a lot.

Now I am trying to expand the bus signals.

What I have now is
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0];


What I need is :

gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_0 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[0];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_1 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[1];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_2 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[2];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_3 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[3];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_4 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4];
# 10  
Old 04-03-2009
I used cut command and it worked .. I also undestand how it wokrs. Thanks a lot.

Now I am trying to expand the bus signals.

What I have now is
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0];


What I need is :

gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_0 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[0];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_1 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[1];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_2 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[2];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_3 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[3];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_4 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4];
# 11  
Old 04-03-2009
Thanks a lot for your help and I used the cut command and it works

Now I need to get the buses expanded.

What I have:

gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0];


What I need :


gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_0 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[0];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_1 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[1];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_2 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[2];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_3 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[3];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_4 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4];
# 12  
Old 04-03-2009
Thanks a lot for your help and I used the cut command and it works

Now I need to get the buses expanded.

What I have:

gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0] = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4:0];


What I need :


gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_0 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[0];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_1 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[1];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_2 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[2];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_3 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[3];
gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7_4 = gtgti1/gtgticcrunit1/gtgti_ccrunit_10n/port_arbiter1/port7[4];
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

2. Shell Programming and Scripting

Count the occurances of numbers

I have a file as shown below. I need to count the unique occurrences of numbers in the first and second column only if the third column is <= 10. Otherwise print the corresponding numbers as zero. Thanks in advance!:) 58 80 40.74 76 80 9.78 76 80 8 12 6 9 30 28 8.23 45 12 ... (13 Replies)
Discussion started by: andreaalex
13 Replies

3. Shell Programming and Scripting

occurances

Hi, I have 2 files File 1 ABC XYZ MNO WER FDS CFG File 2 ABC_123456_234567 ABC_123456_234567 ABC_123456_234567 ABC_123456_234567 ABC_123456_234567 (1 Reply)
Discussion started by: Diya123
1 Replies

4. Shell Programming and Scripting

removing a word in a multiple file starting at the dot extension

hi I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies

5. UNIX for Dummies Questions & Answers

changing all occurances

how wouldi change all occurances of that to they regardless of the number of times it appears on a line? (2 Replies)
Discussion started by: trob
2 Replies

6. UNIX for Dummies Questions & Answers

replacing all occurances

How would i replace all occurreneces of Tim(ignoring the case) with Timithoy in the file "file1" and then save it to "newfile" (2 Replies)
Discussion started by: JamieMurry
2 Replies

7. Shell Programming and Scripting

Count occurances of X Y Z in a file in 1 go.

Hi. I need to count multiple occurrences of X Y Z in a file in 1 go. At the moment I have the following scripts: ssh readonly@$ServerIP 'YEAR=xx;DAY=xx;MONTH=xx;LMONTH=xx;for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 \ 16 17 18 19 20 21 22 23; do cat... (13 Replies)
Discussion started by: msullivan
13 Replies

8. UNIX for Dummies Questions & Answers

occurances

Hi, Anyone know how to do the following? :eek: I Have a file as follows: happygoluckypeoplearenotalwayshappy happyisawordthatisnotusedalot If the word "happy" is present MORE than once in EACH line, I want to delete the line, hence in the above case, the first line will be deleted. ... (8 Replies)
Discussion started by: dr_sabz
8 Replies

9. UNIX for Dummies Questions & Answers

Count occurances in a file

Hi, I have a fixed width file in the following format Sr.No A.No Name 1 2 PPP 3 4 PPP 5 6 TTT 7 8 OOO 9 10 OOO 11 12 OOO The 3rd column starts at position 10 and ends at 15. I want to count the number of occurances of each Name and output to a file Example in the... (2 Replies)
Discussion started by: samit_9999
2 Replies

10. UNIX for Dummies Questions & Answers

Counting Occurances in Two Files

I have two files I want to compare, one is a list of variables and the other is a text file COBOL program. Basically what I want to do is display only those variables that appear in the COBOL program only once. However I would also accept a count of each variable as it appears in the COBOL... (2 Replies)
Discussion started by: Keith Gergel
2 Replies
Login or Register to Ask a Question