remove space characters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting remove space characters
# 1  
Old 03-11-2008
remove space characters

hello

I have this output
ifspeed 100000000
ifspeed 100000000
collisions 413
collisions 10
duplex full
duplex full


from
kstat bnx | grep ifspeed
kstat bnx | grep collisions
kstat bnx | grep duplex


I want to get


ifspeed: 100000000
ifspeed:100000000
collisions: 413
collisions: 10
duplex: full
duplex: full

So remove the white charcters and add : between both fields.

Any idea?
thanks
# 2  
Old 03-11-2008
solved.

kstat bnx | grep ifspeed | awk '{print $1":"$2}'
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove first 2 characters and last two characters of each line

here's what im trying to do. i have a file containing lines similar to this: data.txt: 1hsRmRsbHRiSFZNTTA1dlEyMWFkbU5wUW5CSlIyeDFTVU5SYjJOSFRuWmpia0ZuWXpKV2FHTnRU 1lKUnpWMldrZFZaMG95V25oYQpSelEyWTBka2QyRklhSHBrUjA1b1kwUkJkd3BOVXpWM1lVaG5k... (5 Replies)
Discussion started by: SkySmart
5 Replies

2. UNIX for Beginners Questions & Answers

Remove characters and replace with space

tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file This removes special characters but how can I replace it with space (4 Replies)
Discussion started by: eskay
4 Replies

3. Shell Programming and Scripting

How to remove alphabets/special characters/space in the 5th field of a tab delimited file?

Thank you for 4 looking this post. We have a tab delimited file where we are facing problem in a lot of funny character. I have tried using awk but failed that is not working. In the 5th field ID which is supposed to be a integer only of that file, we are getting corrupted data as below. I... (12 Replies)
Discussion started by: Srithar
12 Replies

4. UNIX for Advanced & Expert Users

Need to remove leading space from awk statement space from calculation

I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation? Here is my query: cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}' 02:00:00... (1 Reply)
Discussion started by: bizomb
1 Replies

5. Shell Programming and Scripting

Add a space between certain characters Using Perl Scripting

Hello All, I have a variable which is having values like this.. $var=A,B,C,D,E,F,G,H I want to add space after every three alphabets so that my final variable should look like this.. $var=A,B,C, D,E,F, G,H the space should come after the comma of third alphabet.. Pls tell me... (3 Replies)
Discussion started by: smarty86
3 Replies

6. Shell Programming and Scripting

Print characters till the next space when the pattern is found

i have a file which contains alphanumeric data in every line. what i need is the data after certain pattern. the data after the pattern is not of fixed length so i need the data till the space after the pattern. Input file: bfdkasfbdfg khffkf lkdhfhdf pattern (datarequired data not required)... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

7. Shell Programming and Scripting

Insert space between characters using sed

Input: Youcaneasilydothisbyhighlightingyourcode. Putting space after three characters. You can eas ily dot his byh igh lig hti ngy our cod e. How can i do this using sed? (10 Replies)
Discussion started by: cola
10 Replies

8. Shell Programming and Scripting

escape space characters in loop from file

Hi Everyone! I want to build sql inserts from a list of countries/regions saved in a file. The list looks like this: United Kingdom Czech Republic ... The script I run is: while read i; do var=`expr $var + 1`; echo "INSERT INTO calltypes VALUES($var, '$i','$i');" >>... (5 Replies)
Discussion started by: linuca
5 Replies

9. UNIX for Dummies Questions & Answers

wc of characters in a file ignoring white space

Hi everyone, $ more abcdefg.ksh abcdef alpha beta gamma abcdef abcdef lmnop $ wc sachin1.ksh 5 7 132 abcdefg.ksh if you see it shows that file has got 240 characters. I actually want to count how many characters... (1 Reply)
Discussion started by: sachin.gangadha
1 Replies

10. Shell Programming and Scripting

how to separate every 10 characters then space then another 10 charactes

suppose u have a file P2122 AAJJSKKSKSLSKSKMSKMS P2123 AASSJMWJNSJNWHNSKSJ P2126 AHJMKNSAJNSKAKMOKALM P3533 KKKSJMAKKLLMLMSLMSPM P2122 JKKSKKMKKSKKKS--------------NSNJ P2123 NSJN---------MSKMKMKKSLLNSLL P2126 JNJSJNWKMSK-------------SKKSMK P3533 JSNSNPWLLL-SKK----SKKKSKKS so the... (2 Replies)
Discussion started by: cdfd123
2 Replies
Login or Register to Ask a Question