Search Results

Search: Posts Made By: weknowd
850
Posted By RudiC
Your if constructs need to be rearranged, as if...
Your if constructs need to be rearranged, as if the first if conditions is true, the others in the then branch won't come true any more. Try



while read YEAR
do for i in...
752
Posted By Don Cragun
This is another example of why you should always...
This is another example of why you should always tell us what operating system and shell you're using when you post a question in this forum.

From what I have seen in other threads in this forum...
793
Posted By Scott
Have you considered reading "dynamic_years.txt"...
Have you considered reading "dynamic_years.txt" first, in a while-loop, and applying that to the inner for-loop?

e.g.

while read YEAR; do
for i in XYZ_*ABC$YEAR.csv; do
printf "%s\n"...
1,939
Posted By Don Cragun
Go back to nawk or /usr/xpg4/bin/awk with: ...
Go back to nawk or /usr/xpg4/bin/awk with:
/usr/xpg4/bin/awk -F, '$1 == "a" && $4 ~ /^"(2[3-5]|998|1003|14356)"$/ {$1 = "b"}1' file
1,939
Posted By ctac_
This way, you look for a number with 5 digits. ...
This way, you look for a number with 5 digits.
Starting with 2, the second digit can be 3, 4 or 5
the third digit can be 1, 0 or 3 and so on
You must use the | (or) to catch what you need.
sed -E...
1,939
Posted By Yoda
Using nawk:- nawk -F, '$4>=23&&$4<=25{$1="b"}1'...
Using nawk:-
nawk -F, '$4>=23&&$4<=25{$1="b"}1' OFS=, file
1,243
Posted By drl
Hi. Unclear to me what is meant by...
Hi.

Unclear to me what is meant by dynamically. Here is a solution with grep:
#!/usr/bin/env bash

# @(#) s1 Demonstrate delete lines with reference file, grep.

# Utility functions:...
1,200
Posted By Don Cragun
As long as empty lines between sets of data...
As long as empty lines between sets of data aren't important, you can also use:
sed -n '/^Test/,/Ended/p' file
and:
awk '/^Test/,/Ended/' file
both of which produce the output:
Test [Red]
...
1,200
Posted By Aia
Three examples: perl -ne '/^Test|^Time/ and...
Three examples:

perl -ne '/^Test|^Time/ and print' weknowd.file
Test [Red]
Time Started= [2.3] secs
Time Ended = [4.5] secc
Test[Yellow]
Time Started= [2.3] secs
Time Ended = [4.5] secc

...
4,173
Posted By vgersh99
awk -F, '{print FNR,$0}' OFS=, myFile
awk -F, '{print FNR,$0}' OFS=, myFile
1,640
Posted By Don Cragun
What shell are you using? What OS are you using?...
What shell are you using? What OS are you using?

Your pseudo-code raise lots of ambiguities. You have ifs and thens, but no elses or fis.

count it as digit is not a valid shell command and...
1,640
Posted By fpmurphy
#!/bin/bash COUNT=0 cp a/x.csv b/x.csv...
#!/bin/bash

COUNT=0

cp a/x.csv b/x.csv 2>/dev/null
(( $? != 0 )) && (( COUNT++ ))

cp a/d.csv b/f.csv 2>/dev/null
(( $? != 0 )) && (( COUNT++ ))

mv b/x.csv b/vin.csv 2>/dev/null
(( $?...
1,733
Posted By Akshay Hegde
Sorry, use this $ for i in al*.csv; do [ ...
Sorry, use this

$ for i in al*.csv; do [ $(wc -l < "$i" ) -gt 1 ] && zip "${i%%.*}" "$i"; done
2,303
Posted By Don Cragun
Assuming that you're using a shell that...
Assuming that you're using a shell that recognizes basic POSIX shell constructs, you could try something like:
for i in a_cd_*.csv
do if [ $(wc -l < "$i") -gt 1 ]
then printf "%s\n" "$i"
fi...
Showing results 1 to 14 of 14

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