Results 1 to 6 of 6
hi i ve a file list.txt in this manner
0.5303nS 2.0830V 2.0080V 2.2090V
0.5556nS 2.0830V 2.0070V 2.2120V
0.5808nS 2.0830V 2.0070V 2.2150V
0.6061nS 2.0840V 2.0070V 2.2200V
0.6313nS 2.0850V 2.0070V 2.2260V
0.6566nS ...
- 01-07-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 12
script for equal spacing.
hi i ve a file list.txt in this manner
0.5303nS 2.0830V 2.0080V 2.2090V
0.5556nS 2.0830V 2.0070V 2.2120V
0.5808nS 2.0830V 2.0070V 2.2150V
0.6061nS 2.0840V 2.0070V 2.2200V
0.6313nS 2.0850V 2.0070V 2.2260V
0.6566nS 2.0870V 2.0060V 2.2340V
0.6818nS 2.0900V 2.0060V 2.2440V
i need to align the values in the list with equal spacing without any tab characters.
expected output:
0.5303nS 2.0830V 2.0080V 2.2090V
0.5556nS 2.0830V 2.0070V 2.2120V
0.5808nS 2.0830V 2.0070V 2.2150V
0.6061nS 2.0840V 2.0070V 2.2200V
0.6313nS 2.0850V 2.0070V 2.2260V
0.6566nS 2.0870V 2.0060V 2.2340V
0.6818nS 2.0900V 2.0060V 2.2440VLast edited by rajeshhariharan22; 01-07-2009 at 10:54 AM. Reason: unequal spacing in the text
- 01-07-2009 #2Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Try this:
RegardsCode:awk '$1=$1' list.txt > newfile
- 01-07-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 12
thnx
hey thanks a lot
but if my file consists of a few text before the numeric values ,how will allign only my numeric values without changing the text allignment
- 01-07-2009 #4Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
Post an example of the input file and the desired output. Use code tags to keep the format (alignment).
- 01-09-2009 #5Just Joined!
- Join Date
- Jan 2009
- Posts
- 1
Because your before and after are the same I am not entirely sure of what you are after. I think what you are probably looking for is the column utility, 'man column' . If you want to achive equal spacing through scripting I made a post about it here: Kyle Brandt: Bash: Getting Command Line Columns to Line up
Hope this helps,
Kyle
- 01-09-2009 #6Linux User
- Join Date
- Jun 2007
- Posts
- 318


Reply With Quote
