Sponsored Content
Top Forums Shell Programming and Scripting search a line and insert string into specific at position Post 302299701 by daikeyang on Friday 20th of March 2009 11:40:05 PM
Old 03-21-2009
hi, ghostdog74.

I am not changing the password in this way, I want to suspend the user, I add a string to the encrypted password, so the user is not able to login. I am new to Linux, so I do not really know whether or not this is a good practice. And as a practice, I could not user command like "passwd" and "usermod". Still, thanks for your reply.

@general:
Does anybody can help me with this question?

Thank you very much for your time in advance

-Keyang
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to insert line break + string in vi (search & replace )

Hello all i have big test file that has allot of structure text something like this : <foo1 *.html> <blah action> somthing 1 somthing 2 </blah> </foo1 > now i will like to insert 2 more lines of text below the <blah action> so it will be like : <foo1... (1 Reply)
Discussion started by: umen
1 Replies

2. Shell Programming and Scripting

Print lines with search string at specific position

Hi Folks, I have a file with all fields defined by byte position, but any field can be empty so I cannot print lines based on a search of specific columns. I need to print all lines of this file where the string of two characters at byte position 100-101 contains the number 27. Any ideas? ... (4 Replies)
Discussion started by: HealthyGuy
4 Replies

3. Shell Programming and Scripting

KSH - search for string and insert line above

Hi,, Please excuse my lack of knowledge here. I think I am tring to do something fairly advanced yet am a bit of a beginner..... I want to use a korn shell (as is the norm with others in my company) to write a script to search a file for a string and insert some text above that line. Sudo... (5 Replies)
Discussion started by: HugoDarley
5 Replies

4. Shell Programming and Scripting

Insert character in a specific position of a file

Hi, I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this? I tried to add it at 5th position using the below code. It didnt work. Please help!!! awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Discussion started by: gpaulose
1 Replies

5. Shell Programming and Scripting

Search in specific position and print the whole line

I have two files abc.dat and sant.dat (Big file 60k rows) for every line's 1,4 of abc.dat need to seach if this is present on 28,4 of sant.dat every line. if its present the output needs to go to bde.dat Example: contents abc.dat aaaa bbbb cccc dddd contents sant.dat this is... (4 Replies)
Discussion started by: ssantoshss
4 Replies

6. Shell Programming and Scripting

substitute a string on a specific position for specific lines

I woud like to substitue a string on a specific position for specific lines I've got a file and I would like to change a specific string from "TOCHANGE" to "ABCABCAB" For every line (except 1,2, 3 and the last one) , I need to check between the 9th and the 16th digits. For the 3rd line, I... (7 Replies)
Discussion started by: BSF
7 Replies

7. Shell Programming and Scripting

Search string position in a line

WeeksD1|$26.52|$26.52|03/02/2013|12.48|D1|1.09|0|0|0|0|0|.95|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|$0.00|$0.00|$0.00|$0.00|$0.00|$0.00|$... (3 Replies)
Discussion started by: gavemani
3 Replies

8. Shell Programming and Scripting

Insert | in specific position

Hi , I have a file which has line similar to below 13123324234234234234234234234234234 3454546456dfhgfhgh454645654asdasfsdsddfgdgdfg 345345345mnmnbmnb346mnb4565464564564645645 Not for each line for specific position I need to insert some '|' Positions are fixed. Like 3,5,9,11 So the... (5 Replies)
Discussion started by: Anupam_Halder
5 Replies

9. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

10. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies
BINSRCH(3WN)						    WordNettm Library Functions 					      BINSRCH(3WN)

NAME
bin_search, copyfile, replace_line, insert_line - general purpose functions for performing a binary search SYNOPSIS
char *bin_search(char *key, FILE *fp); void copyfile(FILE *fromfp, FILE *tofp); char *replace_line(char *new_line, char *key, FILE *fp); char *insert_line(char *new_line, char *key, FILE *fp); DESCRIPTION
The WordNet library contains several general purpose functions for performing a binary search and modifying sorted files. bin_search() is the primary binary search algorithm to search for key as the first item on a line in the file pointed to by fp. The delim- iter between the key and the rest of the fields on the line, if any, must be a space. A pointer to a static variable containing the entire line is returned. NULL is returned if a match is not found. The remaining functions are not used by WordNet, and are only briefly described. copyfile() copies the contents of one file to another. replace_line() replaces a line in a file having searchkey key with the contents of new_line. It returns the original line or NULL in case of error. insert_line() finds the proper place to insert the contents of new_line, having searchkey key in the sorted file pointed to by fp. It returns NULL if a line with this searchkey is already in the file. NOTES
The maximum length of key is 1024. The maximum line length in a file is 25K. If there are no additional fields after the search key, the key must be followed by at least one space before the newline character. SEE ALSO
wnintro(3WN), morph(3WN), wnsearch(3WN), wnutil(3WN), wnintro(5WN). WARNINGS
binsearch() returns a pointer to a static character buffer. The returned string should be copied by the caller if the results need to be saved, as a subsequent call will replace the contents of the static buffer. WordNet 3.0 Dec 2006 BINSRCH(3WN)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy