hi all!
i have a working that looks like this...
file1
MALE JOHN
MALE ANJO
FEMALE ANNE
MALE JAMES
FEMALE HONEY
FEMALE IZA
what i want to do is insert "M" when the first string is "MALE" and insert "F" when the first string is "FEMALE".
file1
M MALE ... (10 Replies)
Now I have a list of numbers in hand and I try to put the numbers into two columns. Can I do this work with any script? Great thanks to your help!
1A1.log
HF=-240.451527
HF=-240.5213996
1A2.log
HF=-240.451527
HF=-240.5213996
1B.log
HF=-240.4273718
HF=-240.4956636
1C.log... (7 Replies)
hello,
I am writting a regular expression that intend to match any tunnel or serial interface but it doesn't mtach any serial sub-interface.
For example, statement should match "Tunnel3" or "Serial0/1" but shouldn't match "Serial0\1.1" (doesn't include dot ".")
I tried the following but... (3 Replies)
I've a problem to put .h end of the line..below my input file
fg_a
bb
fg_b
bb
fg_c
bb
fg_d
aa
fg_f
ee
and i want the output file as below
fg_a.h
bb
fg_b.h
bb
fg_c.h
bb
fg_d.h (6 Replies)
I have several file as below, and i want to put .txt to specific text contain ^main=EXE^cmd=run script /usr/prog/bd_,
file1
7.9102 12.1528 16.3672 7.4002
^main=EXE^cmd=run script /usr/prog/bd_123^"
line 16.3672 7.3134 17.8711 6.0981
file 2
7.9102 12.1528 16.3672 7.4002 ... (8 Replies)
Hello,
I need to put the following string to the beginning of a file - but it should not create a newline at the end of the string.
So, the file I have is a compressed one - with gzip.
And I would like to add an ASCII-String to the beginning of the file. The string has a length of 69... (5 Replies)
Hello.
I would like to search exactly "string1.string2.string3" and replace it by "new_string1.new_string2.new_string3"
And
I would like to search exactly "string2.string3" and replace it by "new_string2.new_string3"
And
I would not found in the result : "string1.new_string2.new_string3"... (3 Replies)
I have a string:
Code
time=20170303122334
I need the result:
20170303.122334
I did:
CODE:
ttdotss=`echo ${time} |sed 's\(.|{8\}\)/|1 /g'`
Result
sed: Function s\(.|{8\}\)/|1 /g cannot be parsed.
Could you please help me to resolve this issue?
Thanks for contribution (2 Replies)
I have a string time=20170303201234
I want to split it and put a dot
result:
20170303.201234
CODE:
ttdotss=`echo ${time} | {8}.{8}`
Doesn't understand
I tried this:
CODE:
ttdotss=`echo ${time} |cut -c 1-8 | . | cut -c 9-14`
Result:
script: .: argument expected... (4 Replies)
Discussion started by: digioleg54
4 Replies
LEARN ABOUT SUNOS
strcpy
strcpy(9F) Kernel Functions for Drivers strcpy(9F)NAME
strcpy, strlcat, strlcpy, strncat, strncpy, strspn - String operations.
SYNOPSIS
#include <sys/ddi.h>
char *strcpy(char *dst, const char *src);
size_t strlcat(char *dst, const char *src, size_t dstsize);
size_t strlcpy(char *dst, const char *src, size_t dstsize);
char *strncat(char *restrict s1, const char *restrict s2, size_t n);
char *strncpy(char *dst, const char *src, size_t n);
size_t strspn(const char *s1, const char *s2);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
PARAMETERS
dst, src Pointers to character strings.
s1, s2 Pointers to character strings.
n Count of characters to be copied.
DESCRIPTION
The arguments dst, src, s1 and s2 point to strings. The strcpy(), strlcpy(), strncpy(), strlcat() and strncat() functions all alter their
first argument. These functions do not check for overflow of the array pointed to by the first argument.
strcpy()
The strcpy() function copies characters in the string src to dst, terminating at the first null character in src, and returns dst to the
caller. No bounds checking is done.
strncpy()
The strncpy() function copies src to dst, null-padding or truncating at n bytes, and returns dst. No bounds checking is done.
strlcpy()
The strlcpy() function copies a maximum of dstsize-1 characters (where dstsize represents the size of the string buffer dst) from src to
dst, truncating src if necessary. The result is always null-terminated. The function returns strlen(src). Buffer overflow can be checked
as follows:
if (strlcpy(dst, src, dstsize) >= dstsize)
return (-1);
strncat()
The strncat() function appends a maximum of n characters. The initial character of s2 overrides the null character at the end of s1.
strlcat()
The strlcat() function appends a maximum of (dstsize- strlen(dst)-1) characters of src to dst (where dstsize represents the size of the
string buffer dst). If the string pointed to by dst contains a null-terminated string that fits into dstsize bytes when strlcat() is
called, the string pointed to by dst is a null-terminated string that fits in dstsize bytes (including the terminating null character) when
it completes, and the initial character of src overrides the null character at the end of dst. If the string pointed to by dst is longer
than dstsize bytes when strlcat() is called, the string pointed to by dst is not changed. The function returns min{dst-
size,strlen(dst)}+strlen(src). Buffer overflow can be checked as follows:
if (strlcat(dst, src, dstsize) >= dstsize)
return -1;
strspn()
The strspn() function returns the length of the initial segment of string s1 that consists entirely of characters from string s2.
RETURN VALUES
strcpy(), strncat() and strncpy() return dst.
For strlcat(), strlcpy() and strspn(), see the Description section.
CONTEXT
These functions can be called from user or interrupt context.
SEE ALSO strlen(9F), strcmp(9F), bcopy(9F), ddi_copyin(9F)
Writing Device Drivers
SunOS 5.10 7 Sep 2004 strcpy(9F)