Even with ERE, you need to run it twice, perhaps conditionally if the first hits, as you used both start and end field '|'. Otherwise, you miss the following adjacent fields on a line like: "123.|456."
You can add pipes to both ends for the substitute and then remove them:
I could have removed both added pipes with one substitute "s/^|\(.*\)|$/\1/" but these back references are a bit slower, in my experience, so I avoid them where possible.
Two passes can be avoided if a less careful pattern is sought, like "s/\([0-9]\).|/\1/", as it encompasses only one pipe. It mangles any non-numeric field with a trailing numer and dot, like "123|The field count of this line is 3.|xyz".
These 2 Users Gave Thanks to DGPickett For This Post:
Hi all,
I have a bunch of files that are named like 12543, 467249877, etc all over some directories.These files are named only with numbers, they dont have any letters or special characters in their file names. Could you please help me out and give me some command/script to remove only those... (6 Replies)
Hi,
I am trying to cleanup 7 or 10 digits numeric from the file. So for example :
Input :
3M Corporation
3M Inc. 888-356-8765
3M Inc. 356-8765
3M Inc. 3568765
3M Inc. 356-8765
3M 8883568765 Inc.
Output :
3M Corporation
3M Inc. - -
3M Inc. -
3M Inc.
3M Inc. - (8 Replies)
I have a file that has some text that looks like this
Some Text
1. More text
2. Different text
Final Text
I would like the remove the lines of text that start with the numbers.
Some Text
Final Text
I have tried to use cat file.txt | grep -Ev 1. >... (9 Replies)
Hello,
I am working with a list that contains a large number of files listed by their absolute path. I am trying to determine a way to delete the file name at the end of each line, therefore leaving just the directory path. For example, I'd like to go from:
/home/something/file... (2 Replies)
Hi, I have multiple large files which consist of the below format:
I am trying to write an awk or sed script to remove all occurrences of the 00 record except the first and remove all of the 80 records except the last one.
Any help would be greatly appreciated. (10 Replies)
Hi all,
I need to do scrip for printing starting and ending numbers along with count in given file.:wall:
Input: a.txt
10000030
10000029
10000028
10000027
10000026
10000024
10000023
10000021
10000018
10000018
10000017
10000016
10000015
10000014 (2 Replies)
I have a file of a content like this:
abc_bla -def 800
abc_bla -def 802
abc_bla -def 804
abc_bla -def 806
abc_bla -def 808
abc_bla -def 810
abc_bla -def 812
abc_bla -def 814
...
abc_bla -def 898
abc_bla -def 900
abc_bla -def 902
abc_bla -def 904
...
abc_bla -def 990
abc_bla -def... (7 Replies)
Discussion started by: maya3
7 Replies
LEARN ABOUT REDHAT
x3270if
X3270IF(1) General Commands Manual X3270IF(1)NAME
x3270if - command interface to x3270, c3270 and s3270
SYNOPSIS
x3270if [ -v ] action [ ( param [ ,... ] ) ]
x3270if [ -v ] -s field
x3270if -i
DESCRIPTION
x3270if provides an interface between scripts and the 3270 emulators x3270, c3270, and s3270.
x3270if performs one of three functions. In action mode (the default), it passes a single action and optional parameters to the emulator
for execution; the result of the command is written to standard output. In status mode, it reports to standard output the value of one of
the emulator's status fields. In iterative mode, it forms a continuous conduit between a script and the emulator.
OPTIONS -v Turns on verbose debug messages, showing the literal data that is passed between the emulator and x3270if.
-s field
Puts x3270if in status mode: it outputs the value of an emulator status field. Field is an integer in the range 0 through 11. The
value 0 is a no-op and is used only to return exit status indicating the state of the emulator. The indices 1-11 and meanings of
each field are documented on the x3270-script(1) manual page.
-i Puts x3270if in iterative mode. Data from x3270if's standard input is copied to the emulator's script input; data from the emula-
tor's script output is copied to x3270if's standard output. x3270if runs until it detects end-of-file on its standard input or on
the output from the emulator. (This mode exists primarily to give expect(1) a process to run, on systems which do not support bidi-
rectional pipes.)
EXIT STATUS
In action mode, if the requested action succeeds, x3270if exits with status 0. If the action fails, x3270if exits with status 1. In iter-
ative mode, x3270if exits with status 0 when it encounters end-of-file. If there is an operational error within x3270if itself, such as a
command-line syntax error, missing environment variable, or an unexpectedly closed pipe, x3270if exits with status 2.
ENVIRONMENT
x3270, c3270, and s3270 use a pair of pipes for communication with each child process. The values of the file descriptors for these pipes
are encoded as text in two environment variables, which are required by x3270if:
X3270OUTPUT
Output from the emulator, input to the child process.
X3270INPUT
Input to the emulator, output from the child process.
SEE ALSO x3270(1), c3270(1), s3270(1), x3270-script(1)COPYRIGHT
Copyright 1999, 2000 by Paul Mattes.
Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission
notice appear in supporting documentation.
01 May 2002 X3270IF(1)