04-02-2009
Move a line to end of file
Can somebody help me with a script ....
Read a file /etc/inittab
find the string starting with rcml and move it entirely towards the end of file.
rcml:2
nce:/usr/sni/aix52/rc.ml > /dev/console 2>&1
I basically want to change the startup sequence.
10 More Discussions You Might Find Interesting
1. Programming
Hello experts,
I ve a text file I want to go to particular line . what is the best way to do this in c ?
I am tried as follows
fseek ( fh, pos, SEEK_SET);
but this functions moves the file pointer according to a number of bytes. Unfortunately I don't know the exact byte... (7 Replies)
Discussion started by: user_prady
7 Replies
2. Shell Programming and Scripting
Hi,
I have a file called /bb/bin/rstrt.
I need to move the line/entry "ccpm_load_shared_memory" after the entry
"initcorp". The problem is that there are several entries for "initcorp" in this file and I need the entry to be moved only after the first instance of "initcorp"
Is there a way... (5 Replies)
Discussion started by: aoussenko
5 Replies
3. Shell Programming and Scripting
I'm rather new to scripting, and despite my attempts at finding/writing a script to do what I need, I have not yet been successful.
I have a file named "list.txt" of arbitrary length with contents in the following format:
/home/user/Music/file1.mp3
/home/user/Music/file2.mp3... (21 Replies)
Discussion started by: Altay_H
21 Replies
4. Shell Programming and Scripting
My input file is multiline file and I am writing a script to search for a pattern and move the line with the pattern and the next line to the end of the file. Since I am trying to learn awk, I thought I would try it.
My input looks like the following:
D #testpoint 1
510.0
D #testpoint2 ... (5 Replies)
Discussion started by: banjo25
5 Replies
5. Shell Programming and Scripting
Hey guys,
I want move a specific word from the middle of the text and move it the end of the file, which means I want the word to be deleted from it's line and moved to the end of file.
I know how to use sed for adding a word the end of file, but I don't know how to move words.
tnx (2 Replies)
Discussion started by: Johanni
2 Replies
6. Shell Programming and Scripting
Hello,
I'm new to this forum. I've been doing a lot of sed work lately and have found many useful tips on this forum. I've hit a roadblock in a project, though, and could really use some help.
I have a text file with many lines like the following, i.e., some lines begin with a single word... (3 Replies)
Discussion started by: paroikoi
3 Replies
7. Shell Programming and Scripting
Hello Everyone,
I need a help from experts of this community regarding one of the issue that I am facing with shell scripting.
My requirement is to append char's at the end of each line of a file. The char that will be appended is variable and will be passed through command line.
The... (20 Replies)
Discussion started by: Sourav Das
20 Replies
8. Shell Programming and Scripting
Hi ,
I need your help for the below issue.
I have a file which has data as below
An error came (/u01/app/12.csv)
pkg1.func1: detail s 1111-->pkg1.func1: detail s 2222-->
Now pkg1.func1: .... --> can come multiple times in the second line.
I need to arrange the data in the below... (9 Replies)
Discussion started by: bhaski2012
9 Replies
9. Shell Programming and Scripting
Hello,
I'm works on Ubuntu server
My goal : I would like to read file line per line, but i want to started at the end of file.
Currently, I use instructions :
while read line;
do
COMMAND
done < /var/log/apache2/access.log
But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies
10. Shell Programming and Scripting
My file (the output of an experiment) starts off looking like this,
_____________________________________________________________
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
**********************************************************************
Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
init(8) System Manager's Manual init(8)
NAME
init - Process control initialization
SYNOPSIS
/sbin/init [0123456789MmQqSs]
DESCRIPTION
The init program initializes the system by creating and controlling processes. The processes run by init at each run level are defined in
the inittab file. The init program reads and processes the entries in the inittab file.
The init program considers the system to be in a run level at any given time; each run level has a specific group of processes that run at
that level. The init program operates in one of eleven run levels: 0-9 and Ss. Of these, only 0, s, 2, and 3 are configured in the inittab
file by default. The run level changes when a privileged user invokes init. The new init sends appropriate signals to the original init
that tell it which run level to change to.
Running the init program is the last step in the boot process after the root file system is mounted. The init program scans the inittab
file and looks for an entry with the initdefault keyword. If the entry is there, init uses the run level specified in that entry as the
initial run level to enter. If the entry is not found in the inittab file or if the inittab file does not exist, init requests that the
user enter a run level from the system console, /dev/console. If the user enters the letter s, init enters single user state, assigns the
virtual console terminal to the user's terminal and opens it for reading and writing. The su command is invoked and the system displays a
message on the console stating the location of the virtual console.
To change the run level, the user specifies either the 0, 2, 3, or s flag.
For the first post-boot execution of init to a run level other than single user, it searches the inittab file for entries at the new run
level that have the boot or bootwait keywords. If the run level that is specified matches the entry, the init program acts on these
entries before processing other entries in the inittab file. Any special initialization of the system, such as checking and mounting file
systems, takes place before users are allowed on the system. The init program then scans the inittab file to find all entries that are to
be handled for that level.
Before starting a new process, init reads each entry in the inittab file, and for each entry that should be respawned, init forks a child
process. After spawning all required processes, init waits for one of its descendant processes to stop, a power-fail signal, or a signal
that it should change the run level. If one of the preceding three conditions occurs, init reexamines the inittab file. You can add new
entries to the inittab file, but init does not reexamine the file until one of the three previous conditions actually occurs. To immedi-
ately reexamine the inittab file, invoke the init program with the q flag.
FLAGS
Shuts down and halts the system. Changes the run level to a multiuser state with local processes and daemons. Changes the run level to a
multiuser state with remote processes and daemons. Changes run level to that specified by the number flag in the /etc/inittab file. If no
such entry exists, no action is taken and no message is output. Moves control to the console device and halts to single-user mode. Forces
init to reexamine the entries in the inittab file and terminates any live processes which have had their configuration entries removed from
/etc/inittab. Users should be aware that when a getty(8) line has been removed from /etc/inittab, and a login shell is active on the ter-
minal line that was formerly designated in inittab as a getty entry, the login shell will be killed. Changes the run level to a single
user state with only the essential kernel services.
FILES
Specifies the command path Specifies the init command control file Specifies the permanent login accounting file
RELATED INFORMATION
Commands: getty(8), rc0(8), rc2(8), rc3(8), shutdown(8)
Calls: kill(2), reboot(2)
Files: inittab(4) delim off
init(8)