private void button1_Click( object sender, EventArgs e )
{
string s = @"p1=6&p2=7&p3=8";
NameValueCollection nvc = new NameValueCollection();
foreach ( string vp in Regex.Split( s, "&" ) )
{
string[] singlePair = Regex.Split( vp, "=" );
if ( singlePair.Length == 2 )
{
nvc.Add( singlePair[ 0 ], singlePair[ 1 ] );
}
}
}
Ofri's answer gives you everything you asked for. But.. if you don't want to remember the command you can add this to your ~/.bashrc (or equivalent):
csview()
{
local file="$1"
sed "s/,/\t/g" "$file" | less -S
}
This is exactly the same as Ofri's answer except I have wrapped it in a shell function and am using the less -S
option to stop the wrapping of lines (makes less
behaves more like a office/oocalc).
Open a new shell (or type source ~/.bashrc
in your current shell) and run the command using:
csview
Вот (возможно, тоже) простой вариант:
sed "s/,/\t/g" filename.csv | less
Мой проект FOSS CSVfix позволяет отображать файлы CSV в формате таблицы «ASCII art».
Вы можете установить csvtool
(на Ubuntu) через
sudo apt-get install csvtool
и затем запустить:
csvtool readable filename | view -
Это сделает его красивым внутри экземпляра vim, доступного только для чтения, даже если у вас есть некоторые ячейки с очень длинными значениями.
Используя TxtSushi вы можете сделать:
csvtopretty filename.csv | less -S