Hello,
I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it:
char* getext(char *file)
{
char *extension;
int i, j;... (5 Replies)
Hi,
I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this?
when I use command
echo "1\n" > a.txt
and
od -c a.txt
0000000 1 \n \n
0000003
How does it differentiate \n and eof in this case?
Regards,
Venkat (1 Reply)
Hello.
I have a file (old.txt) that I need to copy into another file (new.txt).
Each line on old.txt ends with CR/LF but the position of CR/LF varies from one record to another.
I need to copy each line of record to new.txt and move CR/LF in pos 165.
Can I use awk to achieve this? How?... (8 Replies)
I'm sure this is easy to do but I can't find a one line command with awk or sed to append a char to the end of the string from Nth column.
Any sugestion please?
Thanks (2 Replies)
Hi I am working on a bash script and would know how to use cut or sed to remove
(F/.M/d h) from a text file.
Before
1 text to save (F/.M/d h)
after
1 text to save
Thanks in advance (5 Replies)
Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially):
xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’:
xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’
The same error with all c++ constructors - gcc 4.4.4.
If anyone can throw any light on... (8 Replies)
I have a file with different directories in it. I would need to move one line within the file to the end of the list. Also not there could be blank line in the middle of it. Example
/vol/fs1
/vol/fs2
/vol/fs3
/vol/fs4
/vol/fs5
/vol/fs6
/vol/fs7
So I would need /vol/fs2... (3 Replies)
hey ,
i want to check if the char "#" exist at the end of every line of txt file
and if it dosent then add it for example:
the cat jumped on my mom #
cars can run on water#
i cant get a date
blue
yellow#
will be:
the cat went back home#
cars can run on water#
i cant get a... (2 Replies)
hello everyone,
im new here, and also programming with awk, sed and grep commands on linux.
In my text i have many lines with this config:
1 1 4 3 1 1 2 5
2 2 1 1 1 3 1 2
1 3 1 1 1 2 2 2
5 2 4 1
3 2 1 1 4 1 2 1
1 1 3 2 1 1 5 4
1 3 1 1... (3 Replies)
Need to add a numeric & special char to end of the first line
Existing file:
12-11-16|11 2016 Jan 12:34:55|03:55|
13-10-16|10 2016 Jan 12:34:55|03:55|12-11-16|11 2016 Jan 12:34:55|03:55|
14-10-16|19 2016 Jan 12:34:55|03:55|13-11-16|11 2016 Jan 12:34:55|04:55|
15-10-16|18 2016 Jan... (11 Replies)
Discussion started by: Joselouis
11 Replies
LEARN ABOUT OPENSOLARIS
insstr
curs_insstr(3CURSES) Curses Library Functions curs_insstr(3CURSES)NAME
curs_insstr, insstr, insnstr, winsstr, winsnstr, mvinsstr, mvinsnstr, mvwinsstr, mvwinsnstr - insert string before character under the cur-
sor in a curses window
SYNOPSIS
cc [ flag ... ] file ... -lcurses [ library ... ]
#include <curses.h>
int insstr(char *str);
int insnstr(char *str, int n);
int winsstr(WINDOW *win, char *str);
int winsnstr(WINDOW *win, char *str, int n);
int mvinsstr(int y, int x, char *str);
int mvinsnstr(int y, int x, char *str, int n);
int mvwinsstr(WINDOW *win, int y, int x, char *str);
int mvwinsnstr(WINDOW *win, int y, int x, char *str, int n);
DESCRIPTION
With these routines, a character string (as many characters as will fit on the line) is inserted before the character under the cursor. All
characters to the right of the cursor are moved to the right, with the possibility of the rightmost characters on the line being lost. The
cursor position does not change (after moving to y, x, if specified). (This does not imply use of the hardware insert character feature.)
The four routines with n as the last argument insert at most n characters. If n<=0, then the entire string is inserted.
If a character in str is a tab, newline, carriage return or backspace, the cursor is moved appropriately within the window. A newline also
does a clrtoeol() before moving. Tabs are considered to be at every eighth column. If a character in str is another control character, it
is drawn in the ^X notation. Calling winch() after adding a control character (and moving to it, if necessary) does not return the control
character, but instead returns the representation of the control character.
RETURN VALUES
All routines return the integer ERR upon failure and an integer value other than ERR upon successful completion.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO curs_clear(3CURSES), curs_inch(3CURSES), curses(3CURSES), attributes(5)NOTES
The header <curses.h> automatically includes the headers <stdio.h> and <unctrl.h>.
Note that all but winsnstr() may be macros.
SunOS 5.11 31 Dec 1996 curs_insstr(3CURSES)