12-28-2009
if 4th and 5th character of sting -ge 45 then add 1 to 3rd character
I want to know how to, given a string like W87151WR71C, if the 4th and 5th character (in this case 15) are greater than 45, then to add 1 to the 3rd character (in this case 7) and assign the revised string the variable name MODSTRING.
Thanks in advance. This is ultimately to grab info from serial numbers, like production date and correspond machines with lease numbers.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I need to remove the 5th character of column1 and print the rest.
Can anybody give some advice?
Input:
0001c xx
0001r gg jj
0002y vv
0002p kk
0003q gg ll
0003v tt
0003t gg pp kk
Output:
0001 xx
0001 gg jj (9 Replies)
Discussion started by: Raynon
9 Replies
2. Shell Programming and Scripting
hey champs,
i have a files, whose contents are as follows,
abcdefghijk
lmnopqrstuv
..............
..............
i want to replace every other 3rd character to some specified character.
let here in this file i want to replace each 3rd character to z.
abzdezghzjk
lmzopzrszuv... (2 Replies)
Discussion started by: manas_ranjan
2 Replies
3. Shell Programming and Scripting
How to replace all after 4 character at line? & convert to upper case ?
google.com -> GOOG (2 Replies)
Discussion started by: Trump
2 Replies
4. Shell Programming and Scripting
I have a file with "@" in every line
fdgfgddfg@sfsdfdsf@dfdfd@@vfdfsdfd@
sfsdfs@sdfd@gfhfgh@@ddffg@sdf@
srfgtfsdfs@sdfertrd@eergfhfgh@@ddffg@sdf@
wttrtrt@sdfd@sdfdf@@sdfdfds@@@
I need to remove all the fourth and onwards occurences of "@".
so my final o/p would be
fdgfgddfg@sfsdfdsf@dfdfd@... (7 Replies)
Discussion started by: Shivdatta
7 Replies
5. Shell Programming and Scripting
Hi,
I hope someone can share there scripting fu on my problem,
I would like to delete the 3rd character from a random length of string starting from the end
Example
Output
Hope you can help me..
Thanks in advance.. (3 Replies)
Discussion started by: jao_madn
3 Replies
6. Shell Programming and Scripting
Hi All!
I trying to execute this perl script to extract a particular field in a text file, luckily it works. But, right now I would like to extract 3 more fields in the text file but couldnt get the right syntax on how to do it.
command is:
perl -pe '$_ = (split(//)) . "\n"' TestDoc.txt... (3 Replies)
Discussion started by: VicNetIT
3 Replies
7. Shell Programming and Scripting
I am trying to find/grep the 5th and 6th position character (TX) of a word in a file. I tried to do
grep "....TX" file
The output gives me everything in the file with TX in it. I only need the output with the TX in the 5th and 6th position of the word. Any idea
Example:
test1 car... (5 Replies)
Discussion started by: e_mikey_2000
5 Replies
8. Shell Programming and Scripting
Hi ,
I am looking for a function which will do the following.
1. I have a variable which will hold few special chracter like
SPECIAL_CHARS="& ;"2. I have an escape character.
ESCAPE_CHAR="\"3. Now when I passed some string in the function it will return the same string but now it will... (8 Replies)
Discussion started by: Anupam_Halder
8 Replies
9. Shell Programming and Scripting
Hello to all,
I have the following text where columns are separated by spaces. I want to have the 3rd column separating
3 strings with 2 "_" in the format below:
LeftSring_CentralString_RightString
So, in 3rd column I want to replace all "_" with "-", except the first and last "_"
The... (5 Replies)
Discussion started by: Ophiuchus
5 Replies
LEARN ABOUT FREEBSD
color.4th
COLOR.4TH(8) BSD System Manager's Manual COLOR.4TH(8)
NAME
color.4th -- FreeBSD color-detection boot module
DESCRIPTION
The file that goes by the name of color.4th is a set of commands designed to simplify color logic. The commands of color.4th by themselves
are not enough for most uses. Please refer to the examples below for the most common situations, and to loader(8) for additional commands.
Before using any of the commands provided in color.4th, it must be included through the command:
include color.4th
This line is present in /boot/loader.4th file, so it is not needed (and should not be re-issued) in a normal setup.
The commands provided by it are:
loader_color? Returns FALSE if the loader_color environment variable is set to ``NO'' (case-insensitive) or ``0''. Otherwise
returns TRUE (unless booting serial).
The environment variables that effect its behavior are:
loader_color
If set to ``NO'' (case-insensitive) or ``0'', causes loader_color? to return FALSE, indicating to many modules that color
should not be used.
FILES
/boot/loader The loader(8).
/boot/color.4th color.4th itself.
/boot/loader.rc loader(8) bootstrapping script.
EXAMPLES
Standard i386 /boot/loader.rc:
Use color where applicable:
loader_color="YES"
SEE ALSO
loader.conf(5), loader(8), loader.4th(8)
HISTORY
The color.4th set of commands first appeared in FreeBSD 9.0.
AUTHORS
The color.4th set of commands was written by Devin Teske <dteske@FreeBSD.org>.
BSD
August 6, 2013 BSD