Sponsored Content
Full Discussion: help with finding a string
Top Forums Shell Programming and Scripting help with finding a string Post 302136264 by ghostdog74 on Sunday 16th of September 2007 10:40:32 PM
Old 09-16-2007
try to code up something first nex time
Code:
awk '/^8/{ 
          tochange=substr($0,4,6)
          printf "%s%06s%s\n", substr($0,0,3), tochange-1 ,substr($0,9)          
          }
     !/^8/{print}
' "file"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding part of a string

Hi I am very new to KSH programming and need some help with finding a string in an error log currently i am doing cat FTP_LOG.lis | grep Warning which gives me Warning: Authentication failed. Remaining authentication methods: 'publickey,pas I want to only pick up the test between the... (4 Replies)
Discussion started by: DAFNIX
4 Replies

2. UNIX for Advanced & Expert Users

finding a string in a file

hi all.. I dont know how to search for a string in a file.. I have tried doing.. I did google but didnt get effective answers..my code is as follows: int search(char* filename,const char* username,const char* passwd) { int flag=0; unsigned long fsize=0; unsigned long current=0;... (2 Replies)
Discussion started by: Ume1986
2 Replies

3. Shell Programming and Scripting

finding string at runtime

Hi I am creating a script in shell (sh), in which i will enter a string at runtime. let i will enter the string asdfergtdev_DEV2(or DEV,DEV3,DEV1 etc). i want it will find DEV2(it will be only find DEV2 at last 4 digit 3 in case only DEV,no metter if before it, there is dev) and append _qqq01... (1 Reply)
Discussion started by: inderpunj
1 Replies

4. Shell Programming and Scripting

finding lines only between a certain string

Dear experts, Ive been trying to figure this out for a while, but i cant. Please help. I have a file, with approx 1 million lines. The contents are separated with "----------". Please see example below So my problem is, i need to find all texts that have the keyword "GAA", but i need... (14 Replies)
Discussion started by: aismann
14 Replies

5. Shell Programming and Scripting

Finding a letter in a string

How to check whether a particular string contains dot or not? Here I can not use grep as the string is not in a file. I will get this string from user input Thanks, (2 Replies)
Discussion started by: balamv
2 Replies

6. UNIX for Dummies Questions & Answers

finding my location in a string

I'm a relative newbie and apologize if this is silly... Suppose I have a file with English words and their Spanish translations. I read them in like this: while(getline < myfile > 0) { eng = $1 SPAN = $2 } Now, for every eng in SPAN, I want to scan through SPAN and search for a... (2 Replies)
Discussion started by: DrLeeDetroit
2 Replies

7. Shell Programming and Scripting

Finding a string with another string is found

finding a string with another string is found EX: abs c/- i want to find /-, then copy abs. i know it's easy use awk, but my problem is the substr syntax. substr($2,2,2) will give me /- but the conflict is /- is not always the second characted of the second string. (11 Replies)
Discussion started by: engr.jay
11 Replies

8. Shell Programming and Scripting

finding the Last String in a Line

Hi, i am looking for a command that can help me find the last Sting in a Line ex.. yyeyrtehhehrerry: change this from to here i want to extract END. (5 Replies)
Discussion started by: Rohit1234
5 Replies

9. Shell Programming and Scripting

Finding a string and displaying the text before?

Hi folks. I am trying to script a query of a backup server that will display sessions that are "waiting" for a mount... So for, i query my system which returns a process # that is waiting... The output looks like this: 20,984 Backup Storage Pool Primary Pool T950_TAPE_WIN, Copy Pool... (3 Replies)
Discussion started by: Stephan
3 Replies

10. Shell Programming and Scripting

Finding a string in a file

Hello All, I have a text file, i want to search for a string in it and the string is repeated multiple times in a file i want to get the first occurence of the string in a variable. the content of file is like: I want to grepthe first occurance of "Configuration flow done" and store the... (7 Replies)
Discussion started by: anand2308
7 Replies
Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSuUser(Contributed Perl DocPerl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr(3pm)

NAME
Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr - Use 4-argument "substr" instead of writing "substr($foo, 2, 6) = $bar". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Conway discourages the use of "substr()" as an lvalue, instead recommending that the 4-argument version of "substr()" be used instead. substr($something, 1, 2) = $newvalue; # not ok substr($something, 1, 2, $newvalue); # ok The four-argument form of "substr()" was introduced in Perl 5.005. This policy does not report violations on code which explicitly specifies an earlier version of Perl (e.g. "use 5.004;"). CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
"substr" in perlfunc (or "perldoc -f substr"). "4th argument to substr" in perl5005delta AUTHOR
Graham TerMarsch <graham@howlingfrog.com> COPYRIGHT
Copyright (c) 2005-2011 Graham TerMarsch. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-07 Perl::Critic::Policy::BuiltinFunctions::ProhibitLvalueSubstr(3pm)
All times are GMT -4. The time now is 12:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy