Following may help you in same, let's say you have a Input_file as follows(which is an example as you haven't shown us complete input and didn't tell us about field separator so I am taking it as a test, where field separator is a space and which has 7 columns in it.)
Input_file:
Now following code may help in same.
Output will be as follows.
Where I am changing 2nd columns _ with NULL and other columns (only 5th column in my example file) _ with a string _new charachter which you can put it as per your requirement into code. Let us know if this helps you.
Thanks,
R. Singh
Last edited by RavinderSingh13; 10-13-2015 at 02:23 AM..
This User Gave Thanks to RavinderSingh13 For This Post:
Hi,
I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this?
I tried to add it at 5th position using the below code. It didnt work. Please help!!!
awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done?
Example:
File:
A0199999123
A0199999124
A0199999125
Need to replace 99999 in positions 3-7 with 88888.
Any help is appreciated. (5 Replies)
I have a file that I need to parse using a script. The dates in the file are displayed in the format:
Mar 2, 2011 9:09:31 PM
I have tried using the date command %e and %l but it pads an extra space for the day and hour if they are single digits.
So this I used a normal date command:
... (6 Replies)
Hi, im still new in unix.
i want to ask how to delete character on specific position in line, lets say i want to remove 5 character from position 1000, so characters from position 1000-1005 will be deleted.
i found this sed command can delete 4 characters from position 10, but i dont know if... (7 Replies)
Discussion started by: bluesue
7 Replies
9. Post Here to Contact Site Administrators and Moderators
In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123.
So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
I will appreciate if you help me here in this script in Solaris Enviroment.
Scenario:
i have 2 files :
1) /tmp/TRANSACTIONS_DAILY_20180730.txt:
201807300000000004
201807300000000005
201807300000000006
201807300000000007
201807300000000008
2)... (10 Replies)
Discussion started by: teokon90
10 Replies
LEARN ABOUT SUNOS
langinfo.h
langinfo.h(3HEAD) Headers langinfo.h(3HEAD)NAME
langinfo.h, langinfo - language information constants
SYNOPSIS
#include <langinfo.h>
DESCRIPTION
The <langinfo.h> header contains the constants used to identify items of langinfo data (see nl_langinfo(3C)). The type of the constant,
nl_item, is defined as described in <nl_types.h>.
The following constants are defined. The entries under Category indicate in which setlocale(3C) category each item is defined.
Constant Category Meaning
CODESET LC_CTYPE codeset name
D_T_FMT LC_TIME string for formatting date and time
D_FMT LC_TIME date format string
T_FMT LC_TIME time format string
T_FMT_AMPM LC_TIME a.m. or p.m. time format string
AM_STR LC_TIME ante-meridiem affix
PM_STR LC_TIME post-meridiem affix
DAY_1 LC_TIME name of the first day of the week
(for example, Sunday)
DAY_2 LC_TIME name of the second day of the week
(for example, Monday)
DAY_3 LC_TIME name of the third day of the week
(for example, Tuesday)
DAY_4 LC_TIME name of the fourth day of the week
(for example, Wednesday)
DAY_5 LC_TIME name of the fifth day of the week
(for example, Thursday)
DAY_6 LC_TIME name of the sixth day of the week
(for example, Friday)
DAY_7 LC_TIME name of the seventh day of the week
(for example, Saturday)
ABDAY_1 LC_TIME abbreviated name of the first day
of the week
ABDAY_2 LC_TIME abbreviated name of the second day
of the week
ABDAY_3 LC_TIME abbreviated name of the third day
of the week
ABDAY_4 LC_TIME abbreviated name of the fourth day
of the week
ABDAY_5 LC_TIME abbreviated name of the fifth day
of the week
ABDAY_6 LC_TIME abbreviated name of the seventh day
of the week
ABDAY_7 LC_TIME abbreviated name of the seventh day
of the week
MON_1 LC_TIME name of the first month of the year
MON_2 LC_TIME name of the second month
MON_3 LC_TIME name of the third month
MON_4 LC_TIME name of the fourth month
MON_5 LC_TIME name of the fifth month
MON_6 LC_TIME name of the sixth month
MON_7 LC_TIME name of the seventh month
MON_8 LC_TIME name of the eighth month
MON_9 LC_TIME name of the ninth month
MON_10 LC_TIME name of the tenth month
MON_11 LC_TIME name of the eleventh month
MON_12 LC_TIME name of the twelfth month
ABMON_1 LC_TIME abbreviated name of the first month
ABMON_2 LC_TIME abbreviated name of the second
month
ABMON_3 LC_TIME abbreviated name of the third month
ABMON_4 LC_TIME abbreviated name of the fourth
month
ABMON_5 LC_TIME abbreviated name of the fifth month
ABMON_6 LC_TIME abbreviated name of the sixth month
ABMON_7 LC_TIME abbreviated name of the seventh
month
ABMON_8 LC_TIME abbreviated name of the eighth
month
ABMON_9 LC_TIME abbreviated name of the ninth month
ABMON_10 LC_TIME abbreviated name of the tenth month
ABMON_11 LC_TIME abbreviated name of the eleventh
month
ABMON_12 LC_TIME abbreviated name of the twelfth
month
ERA LC_TIME era description segments
ERA_D_FMT LC_TIME era date format string
ERA_D_T_FMT LC_TIME era date and time format string
ERA_T_FMT LC_TIME era time format string
ALT_DIGITS LC_TIME alternative symbols for digits
RADIXCHAR LC_NUMERIC radix character
THOUSEP LC_NUMERIC separator for thousands
YESEXPR LC_MESSAGES affirmative response expression
NOEXPR LC_MESSAGES negative response expression
YESSTR LC_MESSAGES affirmative response for yes/no
queries
NOSTR LC_MESSAGES negative response ro yes/no queries
CRNCYSTR LC_MONETARY local currency symbol, preceded by
'-' if the symbol sould appear
before the value, '+' if the symbol
should appear after the value, or
'.' if the symbol should replace
the radix character
If the locale's values for p_cs_precedes and n_cs_precedes do not match, the value of nl_langinfo(CRNCYSTR) is unspecified.
The <langinfo.h> header declares the following as a function:
char *nl_langinfo(nl_item);
Inclusion of <langinfo.h> header may also make visible all symbols from <nl_types.h>.
USAGE
Wherever possible, users are advised to use functions compatible with those in the ISO C standard to access items of langinfo data. In par-
ticular, the strftime(3C) function should be used to access date and time information defined in category LC_TIME. The localeconv(3C) func-
tion should be used to access information corresponding to RADIXCHAR, THOUSEP, and CRNCYSTR.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO mkmsgs(1), localeconv(3C), nl_langinfo(3C), nl_types.h(3HEAD), setlocale(3C), strftime(3C), attributes(5), standards(5)SunOS 5.10 30 Aug 2002 langinfo.h(3HEAD)