Featured image of post [PowerShell] 47. -match/-replace 연산자와 정규식

[PowerShell] 47. -match/-replace 연산자와 정규식

PowerShell -match/-replace 연산자가 .NET 정규식 엔진을 쓰는 원리와 $Matches 자동 변수로 캡처 그룹을 꺼내는 법, 이름 있는 캡처 그룹, -replace 치환 문자열에서 $1·${name}으로 참조하는 법을 정리한 챕터다.

Featured image of post [PowerShell] 48. ConvertTo-Json/ConvertFrom-Json

[PowerShell] 48. ConvertTo-Json/ConvertFrom-Json

ConvertTo-Json으로 객체를 JSON 문자열로 바꾸는 법과 -Depth 기본값 함정, ConvertFrom-Json으로 JSON을 PSCustomObject나 -AsHashtable로 되돌리는 법, REST API 연동에서 두 cmdlet이 하는 역할을 정리한 챕터다.

Featured image of post [PowerShell] 49. Import-Csv/Export-Csv/ConvertTo-Csv

[PowerShell] 49. Import-Csv/Export-Csv/ConvertTo-Csv

Import-Csv로 CSV 파일을 PSCustomObject 배열로 읽는 법과 Export-Csv의 -NoTypeInformation 기본값 변화, -Append/-Delimiter 매개변수, Format-Table을 CSV 저장 전에 쓰면 안 되는 이유를 정리한 챕터다.

Featured image of post [PowerShell] 50. ConvertTo-Html과 Out-File

[PowerShell] 50. ConvertTo-Html과 Out-File

ConvertTo-Html로 객체를 HTML 표·목록으로 바꾸는 법과 -Property/-CssUri/-Fragment 매개변수, Out-File로 화면 서식 그대로 파일에 저장하는 법과 리다이렉션 연산자(>)와의 관계를 정리한 챕터다.

Featured image of post [PowerShell] 51. Out-String과 Out-Null

[PowerShell] 51. Out-String과 Out-Null

Out-String으로 객체를 콘솔 서식 그대로 텍스트 문자열로 바꿔 Select-String 같은 텍스트 도구와 연결하는 법과 -Stream 매개변수, 명령 출력을 완전히 없애는 Out-Null 사용법을 정리한 챕터다.

Featured image of post [PowerShell] 52. Get-Date와 TimeSpan

[PowerShell] 52. Get-Date와 TimeSpan

Get-Date로 현재 시각을 DateTime 객체로 받는 법과 -Format/-UFormat 서식 지정자 차이, -AsUTC로 시간대를 변환하는 법, 두 날짜를 뺄셈해 TimeSpan을 얻는 법을 정리한 Part 5 마지막 챕터다.

Featured image of post [PowerShell] 53. 스크립트 작성과 실행(.ps1)

[PowerShell] 53. 스크립트 작성과 실행(.ps1)

PowerShell .ps1 스크립트 파일을 실행하는 법과 실행 정책의 관계, param() 블록으로 스크립트 인자를 받는 법, 점 소싱(dot sourcing)으로 스크립트의 함수·변수를 현재 세션에 가져오는 법을 정리한 Part 6 시작 챕터다.

Featured image of post [PowerShell] 54. if/elseif/else — 조건 분기

[PowerShell] 54. if/elseif/else — 조건 분기

PowerShell if/elseif/else 문법과 조건식 평가 방식, PowerShell 7부터 도입된 삼항 연산자(?:) 문법, elseif 체인이 길어질 때 switch 문으로 바꿔야 하는 이유를 정리한 챕터다.