01-28-2009
how to insert the entry inside the line
Hi
I have a file which contains entry similar to this one:
PX_LIST="2259 2215 270 2635 2874 2713 243 4124 2529 2874 34 477 "
Is there a efficient(short) way to use "awk" or "sed" to enter any number, lets say 7777, as the first number inside the quotes, so the result would look like this:
PX_LIST="7777 2259 2215 270 2635 2874 2713 243 4124 2529 2874 34 477 "
Thanks a lot for any information. -A
9 More Discussions You Might Find Interesting
1. Web Development
I have following.
.
.
.
$userid = 2
.
$query = "select username from users where userid = ".$userid.";";
.
$username = $line;
$data="Some Data Here";
.
$query = "insert into logger (username, data) valuse ($username, $data);";
.
I would like to not have 2 database calls. (3 Replies)
Discussion started by: Ikon
3 Replies
2. Shell Programming and Scripting
Hi Sorry to multipost. I am opening the new thread because the earlier threads head was misleading to my current doubt.
and i am stuck.
list=`cat /u/Test/programs`;
psg "ServTest" | awk -v listawk=$list '{
cmd_name=($5 ~ /^/)? $9:$8
for(pgmname in listawk)
... (6 Replies)
Discussion started by: Anteus
6 Replies
3. Shell Programming and Scripting
Hi All,
I wanted to edit the date value located at /var/opt/CPsuite-R65/fw1/conf/local.scv. The date entry looks like this :
:Signature (">=20100717")
How can I update the date value by 1 day every other day while preserving the margins of the whole file in a shell script? I have... (5 Replies)
Discussion started by: achillesxv
5 Replies
4. Shell Programming and Scripting
Hi All,
I need a shell script which could insert a sequence number column inside a dat file(pipe delimited).
I have the dat file similar to the one as shown below..
|A|B|C||D|E
|F|G|H||I|J
|K|L|M||N|O
|P|Q|R||S|T
As shown above, the column 4 is currently blank and i need to insert sequence... (5 Replies)
Discussion started by: nithins007
5 Replies
5. UNIX for Dummies Questions & Answers
How can I specify special meaning characters like ^ or $ inside a regex range. e.g
Suppose I want to search for a string that either starts with '|' character or begins with start-of-line character.
I tried the following but it does not work:
sed 's/\(\)/<do something here>/g' file1
... (3 Replies)
Discussion started by: jawsnnn
3 Replies
6. Shell Programming and Scripting
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Discussion started by: JolietJake
2 Replies
7. Shell Programming and Scripting
Hi All ,
I have pipe delimiter file with 11 columns . I need to insert 4 empty columns after column 10 . and After 11 column I need to insert a column which is having the same value for all the rows .
My file
1|2|3|4|5|6|7|8|9|10|11
New file
... (11 Replies)
Discussion started by: Hypesslearner
11 Replies
8. Shell Programming and Scripting
Hello folks
I have a file called fill1.txt which contains:
1 2
2 1
1 2
1 2
my other file is called fill2.txt which contains:
1 2 1 2 2 2 1 2 1 2
1 1 2 1 1 2 1 1 1 1
2 2 2 1 1 2 2 1 1 2
1 1 1 2 2 2 1 2 2 1
Now, I am looking for a awk command which could insert fill1.txt between... (1 Reply)
Discussion started by: sajmar
1 Replies
9. UNIX for Beginners Questions & Answers
My server xml file has huge data part of which i'm sharing below.
I wish to add the below text held by variable "addthisline" after the closing braces i.e --> once the first </Connector> tag is found.
addthisline="I need to be inserted after the comments"
Thus my searchstring is... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT ULTRIX
passwd
passwd(5yp) passwd(5yp)
Name
passwd - password file description with the Yellow Pages service implemented
Description
The file stores initial login information, including passwords for each user in the system. Regardless of whether or not the system has
the Yellow Pages service implemented, the file contains the following information:
Name (login name, contains no uppercase)
Encrypted password
Numerical user ID
Numerical group ID
User's real name, office, extension, home phone.
Initial working directory
Program to use as Shell
The name can contain an ampersand (&), meaning insert the login name. This information is set by the command and used by the command.
This is an ASCII file. Each field within each user's entry is separated from the next by a colon. Each user is separated from the next by
a new line. If the password field is null, no password is demanded; if the shell field is null, the system defaults to the shell.
This file resides in the directory. Because of the encrypted passwords, it can and does have general read permission and can be used, for
example, to map numerical user IDs to names.
Appropriate precautions must be taken to lock the file against simultaneous changes if it is to be edited with a text editor. The command
does the necessary locking.
In a Yellow Pages environment, the file can also have a line beginning with a plus (+), which means to incorporate entries from the Yellow
Pages data base. There are three styles of + entries: by itself, + means to insert the entire contents of the Yellow Pages password file
at that point; +name means to insert the entry (if any) for name from the Yellow Pages at that point; +@name means to insert the entries
for all members of the network group name at that point. If a + entry has a nonnull password, directory, gecos, or shell field, it will
override what is contained in the Yellow Pages. The numerical user ID and group ID fields cannot be overridden.
Examples
Here is a sample file:
root:q.mJzTnu8icF.:0:10:Privileged Account:/:/bin/csh
jcj:6k/7KCFRPNVXg:508:10:JC Javert:/usr2/jcj:/bin/csh
+john:
+@documentation:no-login:
+:::Guest
In this example, there are specific entries for users root and jcj, in case the Yellow Pages are temporarily out of service. Alterna-
tively, a user may need specific login information on a given system that differs from the information contained in the Yellow Pages map
for that user. The user, john, will have his password entry in the Yellow Pages incorporated without change. Anyone in the netgroup docu-
mentation will have their password field disabled, and anyone else will be able to log in with their usual password, shell, and home direc-
tory, but with a gecos field of Guest.
Files
See Also
chfn(1), finger(1), login(1), passwd(1), crypt(3), getpwent(3), group(5), adduser(8), vipw(8)
passwd(5yp)