Posts

Showing posts from March, 2024

AWS using Ansible? Yes, it's possible!

  Although, I've used Ansible extensively for a lot of automation and orchestration tasks, using Ansible for AWS was indeed, a new territory for me.  This turned out to be a blessing, since along with using Ansible for AWS tasks, I also learnt how to use WSL (Windows Subsystem for Linux) on a Windows machine. Though WSL's been around for some time, I still hadn't come around to using it since I was mostly using my Macbook pro. Not anymore, though!  Anyway, I have listed below the steps to: Install WSL on Windows 11 23H2 patch Install AWS CLI on Ubuntu 22.04 (Exact version - 22.04.3 LTS) Install Ansible and the amazon.aws collection Use AWS CLI to get the list of  VPCs in the region - us-east-1 (or a region of your choice) Create a python file/script to get the list of VPCs in the region - us-east-1 (or a region of your choice) Create an Ansible playbook to get the list of VPCs in the region - us-east-1 (or a region of your choice.   You may download the comple...

From unique values of first column, get all the values of the 2nd column and print them in the same line by separating them with commas

The what: I have a file as below: $ cat sample.csv DEPT_ID,EMP_NAME 100,Keshava 100,Madhava 100,Narayana 100,Govinda 100,Vishnu 110,Madhusudana 110,Trivikrama 110,Vamana 110,Shridhara 110,Hrishikesha 110,Padmanabha 120,Damodara 120,Sankashana 120,Vasudeva 120,Pradyumna 130,Aniruddha 130,Purushottama 130,Adhokshaja 130,Narasimha 140,Achyuta 140,Janardana 140,Upendra 140,Hari 140,Krishna  The challenge is to make it look like below: $ cat sample.csv DEPT_ID: EMP_NAME (SEPARATED BY COMMA) 100: Keshava, Madhava, Narayana, Govinda, Vishnu 110: Madhusudana, Trivikrama, Vamana, Shridhara, Hrishikesha, Padmanabha 120: Damodara, Sankashana, Vasudeva, Pradyumna, Aniruddha 130: Purushottama, Adhokshaja, Narasimha 140: Achyuta, Janardana, Upendra, Hari, Krishna The How: Method 1 - Using pure shell commands tail -n +2 sample.csv | cut -d "," -f1 | sort -u | while read dept_id; do emp_names=$(grep "${dept_id}" sample.csv | cut -d "," -f2 | tr '\n' ...

Popular posts from this blog

Check if UTL_FILE and FND_FILE are working fine

Modify retention period of workflow queues

Clone database home (clone.pl) deprecated in Oracle 19c