Sponsored Content
Top Forums Shell Programming and Scripting convert two digit in to single digit... Post 302602137 by jayan_jay on Sunday 26th of February 2012 05:46:45 AM
Old 02-26-2012
Code:
$ awk '{sub(/^0/,"",$3); print $0}' infile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Append 0 for single digit entered from command line

I have a script like this-- #!/bin/ksh echo "To pad a 0 before digits from 1-9" for i in $* do echo $i | sed 's//'0'/g' done I run this script as ksh name 1 2 23 34 The output should be 01 02 23 34 Help me in modifying this script. Thanks Namish (2 Replies)
Discussion started by: namishtiwari
2 Replies

2. Shell Programming and Scripting

Replace one digit by two digit using sed

Folks, Is there a simple way to replace one digit by two digit using sed. Example, mydigit1918_2006_8_8_lag1.csv should be mydigit1918_2006_08_08_lag01.csv. I tried this way, but doesn't work. echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/' Thank you, (5 Replies)
Discussion started by: Jae
5 Replies

3. Shell Programming and Scripting

How to convert a 2 digit to 4 digit

Hi All, How can i convert a number 24 to 0024 In the same way how can i convert 123 to 0123? All this has to be done inside a script Thanks in advance JS (6 Replies)
Discussion started by: jisha
6 Replies

4. Shell Programming and Scripting

single digit for day and month on date

hi all, how do i format the date command so it displays day and month in single digits i.e 8 instead of 08 ?? am using the command (in a ksh) : date +%D output i get is 10/08/08 thanks in advance. (5 Replies)
Discussion started by: cesarNZ
5 Replies

5. Shell Programming and Scripting

month in single digit

hi all, how do i get the month in single digit in ksh script ?? my command for date is : /usr/bin/date +%Om/%Oe/%y | sed 's/ //g' which returns "01/16/09" but i need the output to be "1/16/09" i.e the month without leading zero. thanks in advance. (2 Replies)
Discussion started by: cesarNZ
2 Replies

6. Shell Programming and Scripting

Single digit date to double digit date.

I have a var storing date var=`date` Now the date is returned as Mon Feb 2 00:25:48 PST 2009 Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var" My intention in above case is... (3 Replies)
Discussion started by: villain41
3 Replies

7. Shell Programming and Scripting

how to add single digit in front of the word and line in the file.

Hi , how to add the single digit to front of the word and front of the lines in the one file with compare pattern file and get digit. like example pattern file pattern.txt pattern num bala 2 raja 3 muthu 4 File Name: chennai.dat muthu is good boy raja is bad boy selvam in super... (6 Replies)
Discussion started by: krbala1985
6 Replies

8. Shell Programming and Scripting

awk length of digit and print at most right digit

Have columns with digits and strings like: input.txt 3840 3841 3842 Dav Thun Tax Cahn 146; Dav. 3855 3853 3861 3862 Dav Thun Tax 2780 Karl VI., 3873 3872 3872 Dav Thun Tax 3894 3893 3897 3899 Dav Thun Tax 403; Thun 282. 3958 3959 3960 Dav Thun Tax 3972 3972 3972 3975 Dav Thun Tax... (8 Replies)
Discussion started by: sdf
8 Replies

9. Shell Programming and Scripting

how to delete the line if the first letter is a single digit

Hi, I'm trying to acheive the following, I have a dat file in which i have several addresses, If the address starts with a single digit then i have to delete the line, if it starts with 2 or more digits then i have to keep the line Here is a sample of my file: 377 CARRER DE LA... (5 Replies)
Discussion started by: ramky79
5 Replies

10. Shell Programming and Scripting

Checking a single digit in a file using Grep

Hi All, I have a file which keeps count based on completion of a certain activity. I am using the following grep command to return a '1' in case the count is zero grep -ic "0" abc_count.txt Now the issue happens when the count is '10', '20' etc .. in these cases as well it returns a... (5 Replies)
Discussion started by: dev.devil.1983
5 Replies
MAKE_SOCKDFR(8) 					      System Manager's Manual						   MAKE_SOCKDFR(8)

NAME
make_sockdfr - Generates frozen route file for SOCKS server SYNOPSIS
make_sockdfr [infile [outfile] ] DESCRIPTION
make_sockdfr reads in a plain-text route file for the SOCKS server and produces a frozen route file as the output. Both arguments are optional. The default for infile is /etc/sockd.route; the default for outfile is /etc/sockd.fr. You may specify infile while omitting outfile, but you cannot specify outfile without also speficying infile. The contents of the frozen route file is essentially the memory image of the parsed input file. Using the frozen route file can reduce the start-up delay of the SOCKS server program since it no longer has to parse the file contents. When the SOCKS server starts, it always looks for the frozen route file /etc/sockd.fr first. If that file is not found, it then tries to use the plain-text route file /etc/sockd.route. If you use frozen route file, you must remember to run make_sockdfr every time after you modify the plain-text file or the SOCKS server will continue to use the frozen version of a previous route file. To find out the contents of a frozen route file, use dump_sockdfr. FILES
/etc/sockd.fr, /etc/sockd.route SEE ALSO
dump_sockdfr(8), sockd.fr(5), sockd.route(5) AUTHOR
Ying-Da Lee, yingda@esd.sgi.com or yingda@best.com May 6, 1996 MAKE_SOCKDFR(8)
All times are GMT -4. The time now is 08:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy