Beginner!! How to convert data from 1 row to 1 column without sed??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lel7lel7
    New Member
    • Mar 2010
    • 12

    Beginner!! How to convert data from 1 row to 1 column without sed??

    Hi there,
    I have only been using linux for 2 weeks and am struggling with loops. My data is in the form...

    Code:
    [lg45@dev64-mgmt ~]$ echo $start
    25293633 7393500 10578865 25293623 122206254 26797134 41906484
    Id like it to output as

    25293633
    7393500
    10578865
    25293623
    122206254
    26797134
    41906484

    In the current format, if i were to loop it such as 'for i in $start..... would it work or does it need to be in columns? I dont know if the loop im writing is failing because of this or not...

    Code:
    [lg45@dev64-mgmt ~]$ for i in `seq 1 7`; do awk '{ if($3=10 && '$start'>=25293633 && '$stop'<=26315393) print$0}' map.txt; done
    awk: cmd. line:1: { if($3=10 && 25293633
    awk: cmd. line:1:                       ^ unexpected newline or end of string
    Thanks in advance to anyone who can help :)

    Regards
    lel
  • Hydaral
    New Member
    • Jun 2010
    • 24

    #2
    Code:
    {
    	i = 1
    	do {
    		print $i
    		i++
    	}
    	while (i <= NF)
    }

    Comment

    Working...