Adding space after character using sed?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Adding space after character using sed?
# 1  
Old 06-27-2011
Adding space after character using sed?

dears

i have the data below, i want a command ( i think it should be sed) that add a space after the seconds as below :

Jun 24 22:28:18966568406148@
Jun 24 05:47:35966555747744@
Jun 24 05:47:53966560825239@
Jun 24 06:07:52966541147164@
Jun 24 15:49:55966566478883@

thanks a lot.
# 2  
Old 06-27-2011
Post desired output for that sample.
# 3  
Old 06-27-2011
well i want it as below

Jun 24 22:28:18 966568406148@
Jun 24 05:47:35 966555747744@
Jun 24 05:47:53 966560825239@
Jun 24 06:07:52 966541147164@
Jun 24 15:49:55 966566478883@

thanks
# 4  
Old 06-27-2011
Code:
sed 's/./& /15' file

# 5  
Old 06-27-2011
perfect man your are really brilliant thanks alot Smilie
# 6  
Old 06-27-2011
Code:
nawk -F":" '{printf("%s:%s %s\n",$1,$2,$3)}' test
Jun 24 22:28 18966568406148@
Jun 24 05:47 35966555747744@
Jun 24 05:47 53966560825239@
Jun 24 06:07 52966541147164@
Jun 24 15:49 55966566478883@

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

2. Shell Programming and Scripting

Read character by character in line in which space is also included

Hi friend, I have one file , and i want to read that file character by character. I need this script in ksh. while using read option with -n1 am getting error. while read -n1 c read has bad option And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 Replies

3. Shell Programming and Scripting

Adding a character

Hello experts. I trying to achieve 2 things here. I'm trying to convert all of the host names to lower case and add an "m" to each hostname. Can anyone provide some guidance on what I can do? Your input is greatly valued! Here are the desired results: 1. read the host name from a file. 2.... (8 Replies)
Discussion started by: david_tech
8 Replies

4. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

Hi All, Was wondering how I can do the following.... I have a String as follows "ACCTRL000005022RRWDKKEEDKDD...." This string can be in a file called tail.out or in a Variable called $VAR2 Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Discussion started by: mohullah
5 Replies

5. UNIX for Dummies Questions & Answers

sed with variable containing space character

Hi all, I have the following script S1a="13 9 -0.0012041" S1b="13 8 -1.00000 " sed 's/${S1b}/${S1a}/g' funE00.i > tmp1 but the strings are not replaced. Maybe the problem is in the spaces cointaned in the variables? Thanks for your help, Sarah (2 Replies)
Discussion started by: f_o_555
2 Replies

6. HP-UX

Adding space to a filesystem

Hello, I am trying to add space to my existing system and I need a little assistance determining if I have any disk space available to allocate. Here is what I have: DISKS: Class I H/W Path Driver S/W State H/W Type Description... (1 Reply)
Discussion started by: dkranes
1 Replies

7. Shell Programming and Scripting

How to remove space in sed for / character

Hi... i need a script to remove the space before and after the operator like( / ). Ex : Input file apple / manago mango / fresh apple / fresh Desired output: apple/manago mango/fresh apple/fresh Note: betwee the desired operator space should be removed, between words do not remove... (3 Replies)
Discussion started by: vasanth_vadalur
3 Replies

8. UNIX for Dummies Questions & Answers

Adding a character

Hi, I cant seem to figure out how I add a character to an existing one. Heres my problem. So I have a line that looks like this: >56 584848392394958586858484849393 What I want to do is add Num in front of the 56. So basically I want to recognize the > and add Num in front of the... (6 Replies)
Discussion started by: kylle345
6 Replies

9. AIX

Adding space to a filesystem

Hello I have a flesystem that has run out of space. I have tried using the following command to add space: # chfs -a size=+100 /lsrc I get the following error: 0516-404 allocp: This system cannot fulfill the allocation request. There are not enough free partitions or not enough... (9 Replies)
Discussion started by: dkranes
9 Replies

10. Shell Programming and Scripting

how to delete space character with sed

hi all, i want to delete a space character in word on unix script with command sed like : #dia n result: #dian is there anyone will help me ? regards, cahyo (1 Reply)
Discussion started by: cahyo3074
1 Replies
Login or Register to Ask a Question