column space


 
Thread Tools Search this Thread
Operating Systems AIX column space
# 1  
Old 06-26-2008
MySQL column space

Is it possible to give spaces using unix commands at a particular column?

eg:
123 56 89(input)
123 56 89(output)
# 2  
Old 06-26-2008
i need two spaces between 3 and 5
# 3  
Old 06-26-2008
Wrong subforum. Something like this?
Code:
echo "123 56 89(input)" | sed 's/ /  /1'
123  56 89(input)

Next time the right forum, k?!
# 4  
Old 07-05-2008
The input is not constant. It varies repeatedly.
# 5  
Old 07-09-2008
I am going to transfer this thread to the "shell scripting" forum, as it belongs there.

If the input varies, as you say, you have to find a constant pattern to express it. If - for instance - the place where you want to insert a second space is the first place where a "3" and a "5" are separated by a blank then the expression to match this would be

Code:
sed 's/3 5/3  5/'

which would mean "search for the first occurrence of "3-space-5" and replace it with "3-space-space-5".

If, also for example, it is the space between the first two "words" in a line, than the expression would have to be:

Code:
sed 's/ /  /'

This means: search for the first occurrence of "space" and replace it by "space-space". This way "xxx-space-xxx" would become "xxx-space-space-xxx" and "xxxxxx-space-xx" would become ""xxxxxx-space-space-xx".

And so on and so forth. get a book about regular expressions and it will teach you how to do that.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Create the space only in the Third column by awk

Hi All , I am having an input file like this Input file r s e y Pin Numbers s n eppppppppppppppppppc ... (3 Replies)
Discussion started by: kshitij
3 Replies

2. Shell Programming and Scripting

Space moving to next column (awk HTML)

Hi I have create a report and have converted the text output to HTML but in the output there is a sentence "The transaction was aborted by the user.", the spaces between this sentence is considered as separate column. How can I overcome the same? I am providing my code, text output and... (7 Replies)
Discussion started by: Dumpi16
7 Replies

3. Shell Programming and Scripting

Remove of white space when you have multiple column

i have file in which i want to remove white space from each column where ever it exist there is white space at the end of line. i know how to remove white space if i have only 1 column, but i have multiple columns and white space can be in any column. sed 's/ *$//' file ath-miRf10005-akr... (5 Replies)
Discussion started by: mirwasim
5 Replies

4. Shell Programming and Scripting

Change some string in specific column with space

Hello All of Master Script , i need help to solve my problem before : mount /dev/rdsk/c1t69d0s6 /dev/rdsk/c1t69d0s6 /vol/cl123/PURGE1 ufs mount /dev/rdsk/c1t70d0s6 /dev/rdsk/c1t70d0s6 /vol/cl123/PURGE2 ufs expected : mount /dev/dsk/c1t69d0s6 /dev/rdsk/c1t69d0s6 /PURGE1 ufs mount ... (3 Replies)
Discussion started by: k0p0nkkk
3 Replies

5. Shell Programming and Scripting

Insert space in specific column among many columns

Hello, I have some problem in inserting the space for the pairs of columns. I have the input file : I used this code below in replacing it using space in specific column (replace space in each two columns) sed -e "s/,/ /2" -e "s/,/ /3" inputfile Output showed : However, I have many... (3 Replies)
Discussion started by: awil
3 Replies

6. Shell Programming and Scripting

Reading first column of file which start with space also

Hi All, I am trying to read first column of my file using command cat temp2_sample.cir|cut -d' ' -f1 The content of my file is as follow R1 pin23I pin27I R2 pin23G pin27G R3 pin27F pin27D RWire10 pin15Y pin23J VCC1 pin27W pin13Y ... (6 Replies)
Discussion started by: diehard
6 Replies

7. Shell Programming and Scripting

Padding space with each column

Hi How do I a add space with each column . Each column has fixed size like 1 st column = 10 2nd column = 20 In each column data can be of variable length.So rest of the length should be space Frank Student Sue Admin (3 Replies)
Discussion started by: Chinky23
3 Replies

8. Shell Programming and Scripting

Delete Space between last and first column

HI Input A R04 tion=1 Li 51599 R08 tiea=1 Li 51995 R11 ocatea=1 Li 51992 R12 nArea=1 Li ... (2 Replies)
Discussion started by: asavaliya
2 Replies

9. UNIX for Dummies Questions & Answers

Combining three space delimited files by column

I have three space delimited files, how do I combine them by column in Unix? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies

10. Shell Programming and Scripting

Help with script printing column with space

I am having some issues with a script taking in column #5 which has a space and splitting it into another line. I don't want this but I can not figure out why its doing this. Any help is appreciated. Here is my input file (comma delimited): ... (4 Replies)
Discussion started by: n3al10
4 Replies
Login or Register to Ask a Question