Sponsored Content
Full Discussion: moving char to end
Top Forums UNIX for Dummies Questions & Answers moving char to end Post 302222620 by vino on Thursday 7th of August 2008 06:45:43 AM
Old 08-07-2008
Quote:
Originally Posted by Ramkum
I need to move the 5th char of a word to its end and first four chars and rest should be retained as it is.

Can any one help me out...
Using sed

Code:
echo "some string" | sed -e "s/\(....\)\(.\)\(.*\)/\1\3\2/"

 

10 More Discussions You Might Find Interesting

1. Programming

Adding a single char to a char pointer.

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)
Discussion started by: pallak7
5 Replies

2. Shell Programming and Scripting

Add end of char \n on end of file

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)
Discussion started by: svenkatareddy
1 Replies

3. Shell Programming and Scripting

Help with shell script: moving end of line character

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)
Discussion started by: udelalv
8 Replies

4. Shell Programming and Scripting

Append char to the end of string from Nth column

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)
Discussion started by: cabrao
2 Replies

5. Shell Programming and Scripting

Remove special char from end of the file

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)
Discussion started by: pelle
5 Replies

6. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

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)
Discussion started by: GSO
8 Replies

7. Shell Programming and Scripting

Moving a line to the end of the file

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)
Discussion started by: bombcan
3 Replies

8. UNIX Desktop Questions & Answers

add char o end of line if dosent exist

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)
Discussion started by: boaz733
2 Replies

9. Shell Programming and Scripting

Sed: how to merge two lines moving matched pattern to end of previous line

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)
Discussion started by: satir
3 Replies

10. Shell Programming and Scripting

Need to add a numeric & special char to end of the first line

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
curs_insstr(3)						     Library Functions Manual						    curs_insstr(3)

NAME
curs_insstr, insstr, insnstr, winsstr, winsnstr, mvinsstr, mvinsnstr, mvwinsstr, mvwinsnstr - Insert a string before the character under the cursor in a Curses window SYNOPSIS
#include <curses.h> int insstr( const char *str ); int insnstr( const char *str, int n ); int winsstr( WINDOW *win, const char *str ); int winsnstr( WINDOW *win, const char *str, int n ); int mvinsstr( int y, int x, const char *str ); int mvinsnstr( int y, int x, const char *str, int n ); int mvwinsstr( WINDOW *win, int y, int x, const char *str ); int mvwinsnstr( WINDOW *win, int y, int x, const char *str, int n ); LIBRARY
Curses Library (libcurses) STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: insstr, insnstr, winsstr, winsnstr, mvinsstr, mvinsnstr, mvwinsstr, mvwinsnstr: XCURSES4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. DESCRIPTION
These routines insert a character string (as many characters as will fit on the line) 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 routines insert the entire string. If a character in str is a tab, newline, carriage return, or backspace, the routines move the cursor appropriately within the window. A newline also causes 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. NOTES
The header file <curses.h> automatically includes the header file <stdio.h>. Note that all but winsnstr may be macros. RETURN VALUES
All routines return the integer ERR upon failure and OK upon successful completion. SEE ALSO
Functions: curses(3), curs_clear(3), curs_inch(3) Others: standards(5) curs_insstr(3)
All times are GMT -4. The time now is 09:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy