I have a colon-separated file which contains names of users, among other details. My aim is to extract the line with the name and assign the name to a variable. A sample file is as follows --
Considering the Tabs between the colon and the next character, I use the following code to extract the name --
This code works fine, unless the name contains a single-quote (say, O'Bar, Foo). In such a case, xargs complains that a quote is missing, and hence, the nameVar remains blank. I tried to overcome it, using the following code --
This returns a syntax error message. I'm using a standard KSH shell on a Solaris box.
Thank you for your contributions. Unfortunately, these did not resolve my problem. Perhaps I was not able to explain my requirement correctly. Stripping the name was not an issue for me. The issue was names with single-quotes in them, like O'Bar, Foo. In such a case, the single-qoute in the name would be paired with the single-qoute at the beginning of the awk program, causing rest of the awk program to be ignored, and hence, a syntax-error. So, the single-qoute in the name had to be escaped, before it was passed on to the awk program. I achieved this by using the following code --
I have an input file like
RELTEST_SITE2||RELTEST_SITE2|RELTEST_SITE2|Huawei-BTS|Cell Sites|Huawei|||South/KERALA/COCHIN/KAZIKODE|Active|Not Maint|12|fiber|GCRNUJRNUJB001HBT022|357||RELTEST_BSC2|||||
and i want to add suffix to GCRNUJRNUJB001HBT022 as "12345"
Please do not ask new questions in existing threads. Unless you have new information to a particular problem, please create a new thread in the appropriate forum.
Also, please search the forums first, as it might be that someone has already posted an answer for a similar problem.
Hi I have multiple files for which I want to use awk for the following:
Read each line in each file- if any of the columns match "PVALUE=" followed by the number, then print the line in case the number following "PVALUE=" is greater than 0.05.
I did the following:
ls *.txt | xargs -I @ -P15... (14 Replies)
Hi,
can anyone tell me in detail ?
what the following do in detail ?
I am trying to get a largest number in a list
Thanks
Tao
LARGEST=$(echo $* | xargs -n1 | sort -nr | tail -1) (3 Replies)
Hi,
I want to find some files and then search for some lines in it with a particular pattern and then write those lines into a file. To do this I am using something like this from command prompt directly.
cd /mdat/BVG
find -name "stmt.*cl" -newer temp.txt | xargs -i awk '/BVG-/{print}' {} >... (7 Replies)
hi
Could any one please tell me the option using which we can run multiple commands using xargs
I have list of files, I want to run dos2unix and chmod at one shot on them
I tried google n searched man pages but couldnt really find the solution , please help
right now im doing this
ls... (4 Replies)
Hello there,
Let me show you a simple example of what I am trying to achieve:
1) I have an input text file with some lines:
1 a
2 b
3 c
2) And I want to run a command with these lines as arguments (+ arbitrary extra arguments). For example:
$ command "1 a" "2 b" "3 c" "bye"
I... (7 Replies)
Hi,
I have a requirement to RCP the files from remote server to local server.
Also the RCP has to run in parallel. However using 'xargs' retrives 2 file names during each loop. How do we restrict to only one file name using xargs and loop till remaining files.
I use the below code for... (2 Replies)
I discovered that GNU's xargs has a -P option to allow its processes to run in parallel. Great! Is this a GNU thing, or is it supported by other platforms as well? (4 Replies)
Can I use xargs to send a list of commands to a process, to be acted upon individually? Here's what I have: a file that contains numbers, one per line. The desired outcome it to send each number to a DB2 query. I thought xargs would work, but it doesn't. I tried it like this:
cat file | xargs |... (4 Replies)