Search Results

Search: Posts Made By: sam05121988
1,860
Posted By sam05121988
for i in user1 user4 usern do grep -B2 "$i"...
for i in user1 user4 usern
do
grep -B2 "$i" file | sed 's/^/#/g'
grep "$i" file | sed 's/^/#/g'
grep -A1 "$i" file | sed 's/^/#/g'
done
2,845
Posted By sam05121988
if you have perl on solaris... perl -ne 'if...
if you have perl on solaris...
perl -ne 'if (/<name>(.*)<\/name>/) {print "$1";}' deploy.tmp
3,544
Posted By sam05121988
perl solution $ cat test2 11,aa,22,ss ...
perl solution


$ cat test2
11,aa,22,ss
12,ss,23,ff
11,aa,22,ss
12,ss,23,ff


Script and usage
$ perl drop_columns.pl
Usage: drop_columns.pl -d:<delim> -f:fields -file:filename

Script...
3,544
Posted By sam05121988
You don't need a script for that, can do it using...
You don't need a script for that, can do it using cut command
cut -d',' -f1 test1
cut -d',' -f1,3 test2
2,164
Posted By sam05121988
perl -ne '@arr = split(/\|/,$_,-1); ...
perl -ne '@arr = split(/\|/,$_,-1);
for($i=0;$i<@arr;$i++) {
next if $i =~ /^(5|7|8)$/ ;
$flag = 1 if ($arr[$i] eq "");
}
print join("|",@arr) if $flag;
' file.txt
Forum: Programming 05-25-2015
1,825
Posted By sam05121988
$vi ab.py prev_line_has_tag=False with...
$vi ab.py
prev_line_has_tag=False

with open('file2.xml','r') as f1:
for line in f1:
print("",line,sep='',end="")
if line.startswith("<!--"):
...
1,111
Posted By sam05121988
Input File $ cat abc Jane,group=A ...
Input File

$ cat abc
Jane,group=A
Bob,group=A
Bob,group=D
Joe,group=B
Bill,group=A
Cathy,group=C
David,group=A
David,group=B
Ed,group=A

Code

$ perl -e '
my $hash;
while(<>){...
3,083
Posted By sam05121988
$line = "whatever your want to print" printf...
$line = "whatever your want to print"
printf "$line" | perl -ne ' @x = split("",$_); print "$_\n" foreach(@x); '
3,083
Posted By sam05121988
just type perl -v on your command line if...
just type
perl -v
on your command line
if it gives output like this, you are good to use the command line provided by me in the other comment

perl -v

This is perl, v5.10.1 (*) built for...
3,083
Posted By sam05121988
if it's ok to use perl $ printf "abc def ...
if it's ok to use perl

$ printf "abc def ghi" | perl -ne ' @x = split("",$_); print "$_\n" foreach(@x); '
a
b
c

d
e
f




g
h
i
3,551
Posted By sam05121988
If you have or can have XML::Simplemodule...
If you have or can have
XML::Simplemodule installed

perl -MXML::Simple -e '
foreach (@ARGV) {
$x_in = XMLin("$_");
print "$x_in->{name}";
}
' *.xml$ cat b.xml
<?xml version="1.0"...
3,674
Posted By sam05121988
Unable to unlink files perl
Hi,

I have a dir and some files as below (all have full perm)


drwxrwxrwx 2 sam sam 4096 Aug 8 04:31 /home/sam/test

$ ll /home/sam/test
-rwxrwxrwx 1 sam sam 0 Aug 8 04:31...
3,973
Posted By sam05121988
Perl combine multiple map statements
I have a file like

file.
file.TODAY.THISYEAR
file.TODAY.LASTYEARI want to substitute the words in caps with their actual values so that output should look like
file.140805
file.140805.2014...
2,653
Posted By sam05121988
use absolute path of isql in your shell script
use absolute path of isql in your shell script
7,345
Posted By sam05121988
Wow!!!, thanks to all of you for your responses. ...
Wow!!!, thanks to all of you for your responses.
I got what I wanted :b:
7,345
Posted By sam05121988
Insert a value in a pipe delimited line (unsig sed,awk)
Hi,

I want to insert a value (x) in the 3rd position of each line in a file like below

a|b|c|d|1
a|b|c|d
a|b|c|d|e|1
a|b|cso that output file looks like

a|b|x|c|d|1
a|b|x|c|d...
2,179
Posted By sam05121988
if you are on a linux system this will definetly...
if you are on a linux system this will definetly work in bash, for unix you will need to test in ksh

#!/bin/bash

Date=`date "+%Y%m%d"`

for fl in /prd/pdw/Backup/*${Date}*
do
...
3,593
Posted By sam05121988
Edit a file in perl
Hi,

I have a file like
$ cat abc
HDR XXX
content XXX
content YYY
content XXX
content YYY
content XXX
content YYY
TRL YYYI want to replace the lines staritng with HDR and TRL
For this I...
1,315
Posted By sam05121988
Thanks again
Thanks again
1,315
Posted By sam05121988
Thanks KlashXX Asking a little more help,...
Thanks KlashXX

Asking a little more help, can you please explain the below snippet

my $line;
foreach (<FA>)
{ #getting rid of TAILER in fileA
print TMP $line if $line;...
1,315
Posted By sam05121988
Efficiently altering and merging files in perl
I have two files

fileA
HEADER LINE A
CommentLine A
Content A
....
....
....
TAILER AfileB
HEADER LINE B
CommentLine B
Content B
....
....
....
TAILER BI want to merge these two...
3,979
Posted By sam05121988
Thanks Don for the fix :)
Thanks Don for the fix :)
3,979
Posted By sam05121988
Thanks Pikk45 :)
Thanks Pikk45 :)
3,979
Posted By sam05121988
Cron doesn't run job in background
Hi,

First of all merry christmas and Happy holidays to all :D

My situation is as below,
When a backup job runs on a mainframe server, it creates a 0byte file on a network drive which is...
3,030
Posted By sam05121988
figured out the solution myself, thanks for your...
figured out the solution myself, thanks for your help
Showing results 1 to 25 of 82

 
All times are GMT -4. The time now is 06:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy