# strip lines out of file and make new file of lines removed and modified
# set up patterns - any regex will work
BEGIN {
MY_PAT="835100000000000638"
NEW_PAT="835100000000000639"
}
# This clause is executed on the opening of each file on the command line
# It first checks to see if this is not the first file and cleans up the
# previous files and copies the new stripped file to the old file
# NOTE: I would prefer if it didn't overwrite the input file...
# It then creates the names and commands it will need later
(FNR == 1) { # check if first line of new file
if ( NR != 1) # see if this is not first file
{
close(FILEOUT) # if true, then we close previous files
close(FILELOG)
system(FILECP) # do the copy
system(FILERM) # remove the work file
}
FILEOUT = FILENAME ".strip" # create striped file name using input file name
FILELOG = FILENAME ".new" # create new file
FILECP = "cp " FILEOUT " " FILENAME # copy command
FILERM = "rm " FILEOUT # remove strip file
}
# This clause executes for every line
# It copies lines from the input file to the appropriate output file
{
if ( sub(MY_PAT,NEW_PAT) == 0 ) # test for pattern in line
print > FILEOUT # save to stripped file if pattern not found
else
print > FILELOG # save to remove log if pattern match
}
# This clause is executed when the last line of the last file is reached
END {
system(FILECP) # clean up last file
system(FILERM)
}
Then execute:
Code:
awk -f strip.awk <data.file>
It will create a file with .new with the removed lines....
One of the things that I have learned to take for granted in the Win32 world is the cut, copy and paste hotkeys of ^X, ^C and ^V.
I use these keys all the time under Win32 to copy and paste information from one GUI into another GUI.
My question is, does X have a similiar standard?
... (4 Replies)
hi i am new to shell scripting,
i have been trying to cut columns numbered 1,4 of a file consisiting of 4 columns. Each column is seperated by 2 spaces.
for example:
john 6102097199 tennessee usa
michel 6734590899 texas USA
now, i need to cut the name... (3 Replies)
Hello
I have a very large file where say each line is made up of 80 characters.
I want to cut the characters from 20-30 and 50-60 from each line and then insert a delimiter between them (# or | etc).
eg
input file
000000000131.12.20990000590425246363375670011200140406... (5 Replies)
Hi i need a favour
i have a file which has some trillions of records. The file is like this
11111000000000192831840914000000000000000000000000000
45789899090000000000000000011111111111111111111111111
I want to cut specific postions in each line like cut1-3 and assisgn it to a variable and... (5 Replies)
Hello,
I want to be able to cut and paste columns from two tables in one command.
Presently I do the following:
cut -f 1,3-6,9 table1.in > table1.out
cut -f 7,6,1-3 table2.in > table2.out
paste table1.out -d '\t' table2.out > MergedTable.out
Is there a better way to do this?
... (1 Reply)
hi,
I have a file with content like this for an employee:
EmployeeID
101
Day_type, day
vacation,1/2/2009
sick day, 3/2/2009
personal day, 4/5/2009
jury duty day, 5/5/2009
how do I make the result to show:
EmployeeID,Day_type,day
101,vacation,1/2/2009
101,sick day,... (6 Replies)
Hello,
I am working on unix for the first time.
I have to write a shell script where i want to cut paste from one file to other.
File "1234.abc" is
03,12345555
16,936,x,x,120
16,936,x,x,100
49,12345555
03,12347710
16,936,x,x,115
16,936,x,x,122
49,12347710
03,12342222... (9 Replies)
I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks (3 Replies)
let i have A file and B file
A has contains 4 fields as below
----------------
f1 f2 f3 f4
B file consists of 5 fields as below
--------------------
f5 f6 f7 f8 f9
need to display as below output:
f5 f1 f3 f8 f9 (2 Replies)
Hello,
I have some problem in cut or paste command for my text data.
Input1.txt :
I use cut command :
cut -d ' ' -f1 Input1.txt > result.txt result.txt :
Then, I use paste command to merge result.txt.
paste -d ' ' result.txt Input1.txt > output.txt output.txt showed :
I use cut... (1 Reply)
Discussion started by: awil
1 Replies
LEARN ABOUT REDHAT
strip
STRIP(1) GNU Development Tools STRIP(1)NAME
strip - Discard symbols from object files.
SYNOPSIS
strip [-F bfdname |--target=bfdname ]
[-I bfdname |--input-target=bfdname ]
[-O bfdname |--output-target=bfdname ]
[-s|--strip-all] [-S|-g|-d|--strip-debug]
[-K symbolname |--keep-symbol=symbolname ]
[-N symbolname |--strip-symbol=symbolname ]
[-x|--discard-all ] [-X |--discard-locals]
[-R sectionname |--remove-section=sectionname ]
[-o file ] [-p|--preserve-dates]
[-v |--verbose] [-V|--version] [--help]
objfile...
DESCRIPTION
GNU strip discards all symbols from object files objfile. The list of object files may include archives. At least one object file must be
given.
strip modifies the files named in its argument, rather than writing modified copies under different names.
OPTIONS -F bfdname
--target=bfdname
Treat the original objfile as a file with the object code format bfdname, and rewrite it in the same format.
--help
Show a summary of the options to strip and exit.
-I bfdname
--input-target=bfdname
Treat the original objfile as a file with the object code format bfdname.
-O bfdname
--output-target=bfdname
Replace objfile with a file in the output format bfdname.
-R sectionname
--remove-section=sectionname
Remove any section named sectionname from the output file. This option may be given more than once. Note that using this option inap-
propriately may make the output file unusable.
-s
--strip-all
Remove all symbols.
-g
-S
-d
--strip-debug
Remove debugging symbols only.
--strip-unneeded
Remove all symbols that are not needed for relocation processing.
-K symbolname
--keep-symbol=symbolname
Keep only symbol symbolname from the source file. This option may be given more than once.
-N symbolname
--strip-symbol=symbolname
Remove symbol symbolname from the source file. This option may be given more than once, and may be combined with strip options other
than -K.
-o file
Put the stripped output in file, rather than replacing the existing file. When this argument is used, only one objfile argument may be
specified.
-p
--preserve-dates
Preserve the access and modification dates of the file.
-x
--discard-all
Remove non-global symbols.
-X
--discard-locals
Remove compiler-generated local symbols. (These usually start with L or ..)
-V
--version
Show the version number for strip.
-v
--verbose
Verbose output: list all object files modified. In the case of archives, strip -v lists all members of the archive.
SEE ALSO
the Info entries for binutils.
COPYRIGHT
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 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.1 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.13.90.0.18 2003-02-24 STRIP(1)