06-29-2009
Just an added question: how can i search for STRINGS and copy the entire line that contains those STRINGS? Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a perl function in my script that needs to replace an entire line in a file
sub changestate {
my $base = ();
my @base = ();
open(BASE, $file) || die("Could not open file!");
@base=<BASE>;
close (BASE);
foreach $base(@base)
{
if($base =~... (1 Reply)
Discussion started by: insania
1 Replies
2. Shell Programming and Scripting
hey gurus,
my-build1-abc
my-build10-abc
my-build2-abc
my-build22-abc
my-build3-abc
basically i want to numerically sort the entire lines based on the build number. I dont zero pad the numbers because thats "how it is" ;-)
sort -n won't work because it starts from the beginning.
... (10 Replies)
Discussion started by: gurpal2000
10 Replies
3. UNIX for Dummies Questions & Answers
Sorry for the title, I really don't know how to word this question or what to even search for. I tried "grep one match", "grep 1 match", "stop grep" on both google and here and haven't found something that helps, so here I go:
I have a file that's about 1.5 million lines long, every line looks... (3 Replies)
Discussion started by: rmoakler
3 Replies
4. OS X (Apple)
how can I do that?
I can paste a line with ctrl+p; but I dont know how to copy it?
ctrl+y - just deletes etc. (2 Replies)
Discussion started by: c_lady
2 Replies
5. Shell Programming and Scripting
Hi,
I have a file whose lines are something like
Tchampionspsq^@~^@^^^A^@^@^@^A^A^Aÿð^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^?ð^@^@^@^@^@^@^@?ð^@^@^@^@^@^@pppsq^@~^@#@^@^@^@^@^@^Hw^H^@^@^@^K^@^@^@^@xp^At^@^FTtime2psq^@ ~^@^^^A^@^@^@^B^A
I need to extract all words matching T*psq from the file.
Thing is... (4 Replies)
Discussion started by: shekhar2010us
4 Replies
6. Shell Programming and Scripting
I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios.
Cat test
Nov 10, 2012 5:17:53 AM
INFO: Request Type
Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies
7. Shell Programming and Scripting
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
8. Shell Programming and Scripting
Hi All,
I have a file testarun.txt contains the below lines and i want to print the lines if the character positions 7-8 matches 01.
201401011111
201401022222
201402013333
201402024444
201403015555
201403026666
201404017777
201404028888
201405019999
201405020000
I am trying the... (4 Replies)
Discussion started by: Arunprasad
4 Replies
9. Shell Programming and Scripting
so im searching the process table with:
ps -ef | awk -F"./rello.java" '{ print substr($0, index($0,$2)) }'
I only want it to print everything that's infront of the "./rello.java". That's because im basically getting the arguments that was passed to the rello.java script.
this works.
... (2 Replies)
Discussion started by: SkySmart
2 Replies
10. UNIX for Beginners Questions & Answers
I want to search a small string in a large string and find the locations of the string. For this I used grep "string" -ob <file name where the large string is stored>. Now this gives me the locations of that string. Now how do I store these locations in a text file.
Please use CODE tags as... (7 Replies)
Discussion started by: ANKIT ROY
7 Replies
LEARN ABOUT NETBSD
strings
STRINGS(1) GNU Development Tools STRINGS(1)
NAME
strings - print the strings of printable characters in files.
SYNOPSIS
strings [-afovV] [-min-len]
[-n min-len] [--bytes=min-len]
[-t radix] [--radix=radix]
[-e encoding] [--encoding=encoding]
[-] [--all] [--print-file-name]
[-T bfdname] [--target=bfdname]
[--help] [--version] file...
DESCRIPTION
For each file given, GNU strings prints the printable character sequences that are at least 4 characters long (or the number given with the
options below) and are followed by an unprintable character. By default, it only prints the strings from the initialized and loaded
sections of object files; for other types of files, it prints the strings from the whole file.
strings is mainly useful for determining the contents of non-text files.
OPTIONS
-a
--all
- Do not scan only the initialized and loaded sections of object files; scan the whole files.
-f
--print-file-name
Print the name of the file before each string.
--help
Print a summary of the program usage on the standard output and exit.
-min-len
-n min-len
--bytes=min-len
Print sequences of characters that are at least min-len characters long, instead of the default 4.
-o Like -t o. Some other versions of strings have -o act like -t d instead. Since we can not be compatible with both ways, we simply
chose one.
-t radix
--radix=radix
Print the offset within the file before each string. The single character argument specifies the radix of the offset---o for octal, x
for hexadecimal, or d for decimal.
-e encoding
--encoding=encoding
Select the character encoding of the strings that are to be found. Possible values for encoding are: s = single-7-bit-byte characters
(ASCII, ISO 8859, etc., default), S = single-8-bit-byte characters, b = 16-bit bigendian, l = 16-bit littleendian, B = 32-bit
bigendian, L = 32-bit littleendian. Useful for finding wide-character strings. (l and b apply to, for example, Unicode UTF-16/UCS-2
encodings).
-T bfdname
--target=bfdname
Specify an object code format other than your system's default format.
-v
-V
--version
Print the program version number on the standard output and exit.
@file
Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or
cannot be read, then the option will be treated literally, and not removed.
Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in
either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a
backslash. The file may itself contain additional @file options; any such options will be processed recursively.
SEE ALSO
ar(1), nm(1), objdump(1), ranlib(1), readelf(1) and the Info entries for binutils.
COPYRIGHT
Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
binutils-2.21.1 2011-06-27 STRINGS(1)