Technology Blog by Ajit

To prefix zero in front of digits

To prefix zero in front of digits

In bash, prefixing zero needs more of formatting, than direct way. This example shows how to prefix zero at the same time maintain the digit width.

#!/bin/bash
export TXT=Number
for LP in `seq -f "$TXT%02g" 12`
do
        echo $LP
done

The output will have the same width.

Number01
Number02
Number03
Number04
Number05
Number06
Number07
Number08
Number09
Number10
Number11
Number12
Newer Post Older Post Home

Blog Archive

  • ►  2021 (1)
    • ►  August (1)
  • ▼  2020 (22)
    • ▼  July (22)
      • Uploading image thru Docker in OCI
      • OCI - Manual creation of Instance from scratch
      • To prefix zero in front of digits
      • SDP tnsnames.ora entry for 2 node rack
      • Changing password in non-interactive
      • IP address validation in linux/bash
      • First time passwordless ssh setup without manually...
      • man-in-the-middle ssh issue
      • LFI-01518: write error
      • How to avoid Blob corruption
      • Check emkey is copied to the repository
      • Mail/sendmail activation in Linux
      • Missing id_rsa file
      • Changing owership of a Listener
      • Connecting OVMM to EMCC
      • Re-configuring SDP IPs
      • Setting up and destroying passwordless ssh to sun ...
      • End to end configuration of SDP listener
      • ORA-16649 with Observer
      • Scripting oracle wallet creation - mkstore
      • Unable to start observer due to DGM-16979 in oracl...
      • DGM-16979 in oracle 11g

Labels

  • Database
  • Exadata
  • Exalogic
  • OCI
  • Scripting
  • Storage

Report Abuse

View Ajit Solomon's profile on LinkedIn
Powered By Blogger

Search This Blog

Theme images by centauria. Powered by Blogger.