(20)
vi a.txt
あああいいい
ううええ
おかきく
-- 1文字ずつ1列で表示
grep -o . a.txt
-- 1行で表示
cat a.txt | xargs | tr -d ' '
-- 列は維持して行方向に逆順表示
tac a.txt
-- 行は維持して列方向に逆順表示
rev a.txt
(11)
vi a.txt
あああいいい
ううええ
おかきく
-- 1文字ずつ1列で表示
grep -o . a.txt
-- 1行で表示
cat a.txt | xargs | tr -d ' '
-- 列は維持して行方向に逆順表示
tac a.txt
-- 行は維持して列方向に逆順表示
rev a.txt
(8)
vi a.txt
あああいいい
ううええ
おかきく
-- 1文字ずつ1列で表示
grep -o . a.txt
-- 1行で表示
cat a.txt | xargs | tr -d ' '
-- 列は維持して行方向に逆順表示
tac a.txt
-- 行は維持して列方向に逆順表示
rev a.txt
- Windows Server
(2019)
https://qiita.com/sukakako/items/ede96f6227f010a0f328
https://munibus.hatenablog.com/entry/2014/08/13/061318
https://win.just4fun.biz/?PowerShell/%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E3%83%AA%E3%83%90%E3%83%BC%E3%82%B9%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95
notepad a.txt
あああいいい
ううええ
おかきく
cat a.txt
-- 1文字ずつ1列で表示
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $path
$fileName = $path + "\a.txt"
$file = New-Object System.IO.StreamReader($fileName, [System.Text.Encoding]::GetEncoding("sjis"))
while (($line = $file.ReadLine()) -ne $null)
{
foreach ($c in $line.ToCharArray()) {$c}
}
$file.Close()
-- 1行で表示
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $path
$fileName = $path + "\a.txt"
$file = New-Object System.IO.StreamReader($fileName, [System.Text.Encoding]::GetEncoding("sjis"))
while (($line = $file.ReadLine()) -ne $null)
{
Write-Host -NoNewline ($line)
}
$file.Close()
-- 列は維持して行方向に逆順表示
$path = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $path
$fileName = $path + "\a.txt"
$file = New-Object System.IO.StreamReader($fileName, [System.Text.Encoding]::GetEncoding("sjis"))
while (($line = $file.ReadLine()) -ne $null)
{
Write-Host ([string]::join("",$line[($line.Length - 1)..0]))
}
$file.Close()
-- 行は維持して列方向に逆順表示
(Get-Content .\a.txt)[(Get-Content .\a.txt).length..0]