Name: totototo Date: March 25, 2008 at 12:56:03 Pacific Subject: sed command OS: xp CPU/Ram: 4GO Model/Manufacturer: windows
Comment:
Hello, i am using sed (gnused for windows)with a batch file. I would like to extract from a text file the following informations: 1,2,3 (second column) A 3 B 3 C 1 C 2 C 3 I have done a code which gives a list instead of a summary of the data inside the list: 3 3 1 2 3 How can i have only the "one number" (1,2,3)? my command is: sed -n "s/[A-Z]*//w Post_temp_list.txt" s_post.txt
use the right tool for the job. sed is not really suited for this type of "column based" problem. You can use gawk instead. Download and install gawk from here: http://gnuwin32.sourceforge.net/pac...
the code:
{ a[$2] } END{ printf "(" for ( i in a) printf "%s," , i print ")" }
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE