Sponsored Content
Top Forums UNIX for Dummies Questions & Answers file feed one line per argument Post 8275 by Perderabo on Tuesday 9th of October 2001 10:22:03 AM
Old 10-09-2001
Quote:
Originally posted by jpprial

[[ ! -z $rstate -o -z $rstate ]] && ((nf=nf+1))

but it complains about the -o option.
Don't do that. The nf stuff is to detect completely blank lines. If you really wanted to unconditionally increment nf at this point, there is no need to add a test that cannot fail. ((nf=nf+1)) could be used all by itself. Add with ksh [[ or it handled by | not -o.

If you don't care whether or not the field rstate has something, just don't test it. Instead, test the stuff you do care about. You are already checking the id field for the number of characters. That leaves the action field. You can just add a "if [[ -z $action ]]" or maybe you'd rather get the length of the action field and see if it's non-zero.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing Carriage Return and or line feed from a file

Hello I'm trying to write a shell script which can remove a carriage return and/or line feed from a file, so the resulting file all ends up on one line. So, I begin with a file like this text in file!<CR> line two!<CR> line three!<CR> END!<CR> And I want to end up with a file... (1 Reply)
Discussion started by: tbone231
1 Replies

2. Shell Programming and Scripting

Unable to display correctly the contents of a file without a line feed

I am using AIX and ksh. I need to display the contents of a file that has a pid (process id). Because the file is open, it doesn't have the line feed or new line, so for some reason if I do this: `cat $pid` , where $pid is the name of the fully qualified file, it displays test3.sh: 426110:... (1 Reply)
Discussion started by: Gato
1 Replies

3. Shell Programming and Scripting

replace last form feed with line feed

Hi I have a file with lots of line feeds and form feeds (page break). Need to replace last occurrence of form feed (created by - echo "\f" ) in the file with line feed. Please advise how can i achieve this. TIA Prvn (5 Replies)
Discussion started by: prvnrk
5 Replies

4. Shell Programming and Scripting

Get the 1st 99 characters and add new line feed at the end of the line

I have a file with varying record length in it. I need to reformat this file so that each line will have a length of 100 characters (99 characters + the line feed). AU * A01 EXPENSE 6990370000 CWF SUBC TRAVEL & MISC MY * A02 RESALE 6990788000 Y... (3 Replies)
Discussion started by: udelalv
3 Replies

5. Shell Programming and Scripting

Remove line feed from csv file column

Hi All, My requirement is to remove line (3 Replies)
Discussion started by: r_t_1601
3 Replies

6. Shell Programming and Scripting

Remove line feed from csv file column

Hi All, i have a csv file . In the 7th column i have data that has line feed in it. Requirement is to remove the line feed from the 7th column whenever it appears There are 11 columns in the file C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 The value in C7 contains line feed ( Alt + Enter ),... (2 Replies)
Discussion started by: r_t_1601
2 Replies

7. Shell Programming and Scripting

Delete a specific line from the feed file

Hi All, I have came across an issue where I will grep for a primary key and then I have to delete that particular line from the feed file and then save it. The feed file is a TAB delimited one. For example: grep 539439AE9 file1 100.00000 20090119 20090119 20090521 ... (4 Replies)
Discussion started by: filter
4 Replies

8. Shell Programming and Scripting

Help in removing control M and Line feed in output file.

Hi All, In my output file i am getting control m character and also the line feeds at different places and with different combinations, the content of the file is supposed to be in a single line but if there is a line feed in between then from there onwards it's going into new line. I tried... (7 Replies)
Discussion started by: Bipin Kumar
7 Replies

9. Shell Programming and Scripting

Want to remove a line feed depending on number of tabs in a line

Hi! I have been struggling with a large file that has stray end of line characters. I am working on a Mac (Lion). I mention this only because I have been mucking around with fixing my problem using sed, and I have learned far more than I wanted to know about Unix and Mac eol characters. I... (1 Reply)
Discussion started by: user999991
1 Replies

10. Shell Programming and Scripting

awk issue splitting a fixed-width file containing line feed in data

Hi Forum. I have the following script that splits a large fixed-width file into smaller multiple fixed-width files based on input segment type. The main command in the script is: awk -v search_col_pos=$search_col_pos -v search_str_len=$search_str_len -v segment_type="$segment_type"... (8 Replies)
Discussion started by: pchang
8 Replies
inittab(4)						     Kernel Interfaces Manual							inittab(4)

NAME
inittab - script for the boot process DESCRIPTION
The file supplies the script to the boot daemon in its role as a general process dispatcher (see init(1M)). The process that constitutes the majority of boot process dispatching activities is the line process that initiates individual terminal lines. Other processes typi- cally dispatched by boot are daemons and shells. The file is composed of entries that are position-dependent and have the following format: Each entry is delimited by a newline; however, a backslash preceding a newline indicates a continuation of the entry. Up to 1024 charac- ters per entry are permitted. Comments can be inserted in the process field by starting a "word" with a (see sh(1)). Comments for lines that spawn are displayed by the command (see who(1)). It is expected that they will contain some information about the line such as the location. There are no limits (other than maximum entry size) imposed on the number of entries within the file. The entry fields are: id A one- to four-character value used to uniquely identify an entry. Duplicate entries cause an error message to be issued, but are otherwise ignored. The use of a four-character value to identify an entry is strongly recommended (see WARNINGS below). rstate Defines the run level in which this entry is to be processed. Run levels correspond to a configuration of processes in the system where each process spawned by boot is assigned one or more run levels in which it is allowed to exist. Run levels are represented by a number in the range through For example, if the system is in run level only those entries hav- ing a in their rstate field are processed. When boot is requested to change run levels, all processes that do not have an entry in the rstate field for the target run level are sent the warning signal and allowed a 20-second grace period before being forcibly terminated by a kill sig- nal You can specify multiple run levels for a process by entering more than one run level value in any combination. If no run level is specified, the process is assumed to be valid for all run levels, through Three other values, and can also appear in the rstate field, even though they are not true run levels. Entries having these characters in the rstate field are processed only when a user process requests them to be run (regardless of the current system run level). They differ from run levels in that boot can never enter "run level" or Also, a request for the execution of any of these processes does not change the current numeric run level. Furthermore, a process started by an or option is not killed when boot changes levels. A process is killed only if its line in is marked in the action field, its line is deleted entirely from or boot goes into the single-user state. action A keyword in this field tells boot how to treat the process specified in the process field. The following actions can be specified: Process the entry only at boot boot-time read of the file. Boot starts the process, does not wait for its termination, and when it dies, does not restart the process. In order for this instruction to be meaningful, the rstate should be the default or it must match boot run level at boot time. This action is useful for an initializa- tion function following a hardware boot of the system. Process the entry only at boot boot-time read of the file. Boot starts the process, waits for its termination, and, when it dies, does not restart the process. An entry with this action is only scanned when boot is initially invoked. Boot uses this entry, if it exists, to determine which run level to enter initially. It does this by taking the highest run level specified in the field and using that as its initial state. If the rstate field is empty, boot enters run level The entry cannot specify that boot start in the single-user state. Additionally, if boot does not find an entry in it requests an initial run level from the user at boot time. If the process associated with this entry is currently running, send the warning signal and wait 20 seconds before forcibly terminating the process via the kill signal If the process is nonexistent, ignore the entry. When boot enters a run level that matches the entry's rstate, start the process and do not wait for its termina- tion. When it dies, do not restart the process. If boot enters a new run level but the process is still running from a previous run level change, the process is not restarted. This instruction is really a synonym for the action. It is functionally identical to but is given a different keyword in order to divorce its asso- ciation with run levels. This is used only with the or values described in the rstate field. Execute the process associated with this entry only when boot receives a power-fail signal see signal(5)). Execute the process associated with this entry only when boot receives a power-fail signal and wait until it terminates before continuing any processing of If the process does not exist, start the process; do not wait for its termination (continue scanning the file). When it dies, restart the process. If the process currently exists, do nothing and continue scanning the file. Entries of this type are executed before boot tries to access the console. It is expected that this entry will be only used to initialize devices on which boot might attempt to obtain run level information. These entries are executed and waited for before continuing. When boot enters the run level that matches the entry's rstate, start the process and wait for its termination. Any subsequent reads of the file while boot is in the same run level cause boot to ignore this entry. process This is a command to be executed. The entire field is prefixed with and passed to a forked as "". For this reason, any syntax that can legally follow can appear in the process field. Comments can be inserted by using the syntax. WARNINGS
The use of a four-character id is strongly recommended. Many pty servers use the last two characters of the pty name as an id. If an id chosen by a pty server collides with one used in the file, the file can become corrupted. A corrupt file can cause commands such as to report inaccurate information. FILES
File of processes dispatched by boot SEE ALSO
sh(1), getty(1M), exec(2), open(2), signal(5). inittab(4)
All times are GMT -4. The time now is 02:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy