0
votes
2answers
54 views

Method to paste specific column when in terminal

I'd like to paste only the third column of data from within the terminal. I originally have something like: 4 SF0086 SF0086 12 SF0087 SF0087 17 TSF141 TSF141 29 TSF070 TSF070 30 TSF028 TSF028 31 ...
0
votes
3answers
78 views

remove new lines

My input is a csv file like this: 10,"Special Projects,bangaram",0,,0 10,"Statutory/ Internal Audit , MO reporting (incl Excel Spreadsheet uploadation) ", bangaram,0,,0 10,"Complience with ...
4
votes
2answers
337 views

Replace string with sequential index

Can someone suggest an elegant way to accomplish this? Input: test instant () test instant () ... test instant () //total 1000 lines output should be: test instant1 () test ...
0
votes
2answers
81 views

Merging two different files with conditions

I have two different files as shown below. Content of a.txt: HDR|1|||||||||| DTL|@||||||||||| TLR||||||||||||| HDR|1|||||||||||| ...
2
votes
1answer
94 views

Why the order of wildcard results might be different when used from the terminal or from perl?

There's a folder with a bunch of files and a perl scrip that lists them using ls with a wildcard like: #!/usr/bin/perl system("ls -U -1 dir/*"); I noticed that if I run exactly the same command ...
1
vote
1answer
121 views

How to safely move a file to another directory and remove duplicates

I want to move files from Downloads, Documents, Pictures, Music, et al to shared locations. This is for various reasons, including because I want to keep media in a central, shared place. I want to ...
1
vote
1answer
422 views

How to filter an array of strings in ksh

Please advise what's wrong in my ksh code. I want to remove the IP's as defined in "bb" array from "aa" array so the IP's 255.0.0.0 and 255.255.255.0 will be removed from the list in aa array. When ...
6
votes
2answers
535 views

Special character '#' in Perl SSH command

I try to send command using SSH in my perl script with # but it gets truncated right at # Example: Input text is : $message = "Product ID # STK000134" The SSH command is : $execute=`ssh -q ...
16
votes
2answers
7k views

What does ${1+“$@”} mean in a shell script, and how does it differ from “$@”?

In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header: #!/bin/sh #! -*-perl-*- eval 'exec perl -x -wS $0 ${1+"$@"}' if 0; What does ${1+"$@"} ...
2
votes
1answer
91 views

How to list all present optical drivers?

How can I list all the installed optical drivers with udev or any other core-based tool (perl is also very good) ? P.S.: I know about the wodim --devices command, but it's an undesirable ...
3
votes
1answer
250 views

Use all system memory in Solaris

I am doing server testing and intentionally trying to crash a virtual Solaris server by using all memory. Server has a ulimit of 15 GB (several hundred GB of total system/swap memory). Is there a ...
2
votes
1answer
90 views

Solaris “clean” group files (or for that matter any text file)

I am looking to find a way to script a cleaning operation on the /etc/group file on a large number of servers. Looking for users in a particular group more than once. i.e. somegroup::100000:userA, ...
1
vote
3answers
458 views

How to move files into newly created directory on condition in shell/perl

It was a mess of music files and directory. It is needed to perform the below operation over multiple directories at once: If the directory contains ".jpg" files, then create a new directory ...
3
votes
4answers
2k views

How to insert the content of a file into another file (if regexp) in shell/perl

File1 Contents: line1-file1 "1" line2-file1 "2" line3-file1 "3" line4-file1 "4" File2 Contents: line1-file2 "25" line2-file2 "24" Pointer-file2 "23" ...
2
votes
1answer
479 views

How to insert a first column to many files + how to convert unix time to normal time

There are many-many files in a directory that has e.x.: the following content: INPUT: root 1324711901 sshd 1272725792 And I'm searching for a solution how to convert the content of the ...
2
votes
1answer
417 views

How do I make a droplet/.app in platypus for my unix command?

This is my sample code from the platypus tutorial. I am trying to make it work with a command named pymol, and I want it to open .pdb files or open just pymol. I know nothing about perl, but I have ...
3
votes
4answers
1k views

Replacing text from a list of replacements. Added complication: backslashes

I have a file A that contains pairs of strings, one per line: \old1 \new1 \old2 \new2 ..... I would like to iterate over file A, and for each line perform the replacement (e.g. "\old1 -> \new1") ...